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: Gary Lists <email@hidden>
- Date: Thu, 05 Feb 2004 10:28:04 -0500
>
> 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.