Re: FileMaker Send Apple Event to run stay open app
Re: FileMaker Send Apple Event to run stay open app
- Subject: Re: FileMaker Send Apple Event to run stay open app
- From: Paul Tuckey <email@hidden>
- Date: Fri, 06 Feb 2004 17:02:39 +0000
Gary, thanks for your help with this.
I have managed to get it to work using the send apple event script step as
you have described though not with 100% reliability. But I'm much further
down the road than I was before.
The Perform AppleScript step method doesn't seem to work in this case
though. The script just sits there indefinitely, I think this is because
FileMakers menus are locked during a FileMaker script so the AppleScript
trying to address those menu items cant reach them and ends up timing out.
The Send Apple Event script step works I guess because it allows the
AppleScript to run independently of the FMP script.
Paul
------------------------------------------------------------------------
MetaClarity Ltd
e-mail: email@hidden
http://www.metaclarity.com/
Tel (00 44) (0) 1760 755 587 | Mobile (00 44) (0) 7974 783 569
>
From: Gary Lists <email@hidden>
>
Date: Thu, 05 Feb 2004 10:28:04 -0500
>
To: AppleScript Users <email@hidden>
>
Subject: Re: FileMaker Send Apple Event to run stay open app
>
>
>> Paul, the specific nature of the saved state of the applet should not matter
>
>> as for the sending of events from FM's 'send event' script step: run-only,
>
>> normal application, stay-open either one.
>
>>
>
>> Perhaps you're sending the wrong event? Or your applet doesn't have an
>
>> appropriate handler...?
>
>>
>
>> Are you using an 'on run' and 'on open' or which?
>
>> --
>
>> Gary
>
>
>
Paul Tuckey wrote [2/5/04 9:16 AM]:
>
>
> Hi Gary, thanks for the input.
>
>
>
> I'm not using a handler I'm trying to get FMP's Send Apple Event script step
>
> to emulate what can be done purely with AppleScript.
>
>
>
Well, any script has an 'on run' handler, whether you type that or not. So,
>
I see below that you have some AS code that you wish to run.
>
>
This is not the same as you asked, which was about how to use the Send Apple
>
Event script step. To run a script as you show below, that is the Perform
>
AppleScript script step. They are different.
>
>
You really can use either to activate and execute your a script application.
>
>
The Send AppleEvent script step allows you to specify an application or
>
document to serve as the 'target' of the AppleEvent.
>
>
Since the event sent is the 'open application' event, then your application
>
needs to have an 'on open' handler. That's okay, because you can always
>
say:
>
>
on open
>
tell me to run
>
end open
>
>
on run
>
...your script
>
end run
>
>
You must use FM to send the 'oapp' event to your application. Luckily, the
>
script step is designed to do just that.
>
>
In your FM script that will activate your external application:
>
>
1. add the Send Apple Event script step.
>
2. click the Specify... button in the script editing window
>
3. choose Open Application from the 'Send the' pop-up menu
>
4. when you do, a navigation dialog will open and you should select your
>
application (best to keep it tucked near your DB file, I think)
>
5. close the window and you've built your 'activation script'
>
>
>
For stay-open applications which have both an 'on open' and an 'on run'
>
handler already, then it is probably best (but a bit less portable) to
>
follow your example method (again, which is the Perform AppleScript script
>
step).
>
>
When you saved your script, you should have chosen As Stay-open Application
>
for the type (depending on your script editor, this will be different; and
>
for AppleScript Studio it will be quite different.)
>
>
To set up your script, based loosely on your example
>
> example
>
> --My trigger application
>
> Tell application "myStayOpenApp"
>
> run
>
> end tell
>
>
>
You will probably need the full path to your application, rather than just
>
its name, or you will be asked to locate it each time the FM script
>
executes.
>
>
Your Perform AppleScript text might be:
>
>
tell application "myStayOpenApp" to run
>
>
Then, in your script, just wrap what you have below in an 'on run' and 'end
>
run' pair, to build the handler. (You don't even have to, actually, because
>
the implicit 'run' handler is there whether you type this or not...but it's
>
better style, IMO.)
>
>
on run
>
tell application "FileMaker Pro" to do menu menu item "Arial Bold" of menu
>
"Font" of menu "Format"
>
end run
>
>
> --myStayOpenApp
>
> tell application "FileMaker Pro"
>
> set fontName to "Arial Bold"
>
> do menu menu item fontName of menu "font" of menu "Format"
>
> end tell
>
>
>
> If I run the trigger application all works fine as all its doing is to send
>
> the run command to the stay open application.
>
>
>
> I could be way of beam here but I was thinking if I can find the 4 character
>
> event class and the event ID for the run command, and key that into the
>
> 'send event' script step that would do the trick?
>
>
Wow, you should really just take a look at the FM Help files. They cover the
>
every easy Send AppleEvent and Perform AppleScript script steps. FM
>
prepares and sends these basic events for you. You don't have to go about
>
creating raw AS event code just to target a script object's run handler.
>
>
> FileMaker gives an example for the do script event ID but that's all. Is
>
> there a way of getting event ID's out of a complied script?
>
>
>
> Paul
>
>
--
>
Gary
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.