Re: Reliably calling an application within Handlers
Re: Reliably calling an application within Handlers
- Subject: Re: Reliably calling an application within Handlers
- From: JollyRoger <email@hidden>
- Date: Sun, 29 Apr 2001 20:55:57 -0500
on 4/29/2001 4:51 AM, Bill Cheeseman at email@hidden wrote:
>
on 4/28/01 5:57 PM, Roderick Scott Corporation at email@hidden wrote:
>
>
> I want to do something like:
>
>
>
> property theApp: "InDesign 1.5.2" as string
>
>
>
> then be able to say
>
>
>
> tell theApp
>
> -- do something
>
> end tell
>
>
This is a big and well-documented issue in AppleScript, sometimes known as
>
the "double-tell" issue. You can do what you're trying to do, but it will
>
take some work. You will find a detailed writeup, with references to others'
>
writeups, on The AppleScript Sourcebook, in two articles in the "Tips"
>
chapter.
Take Bill's advice.
And here's an example of what I consider to be a better method than the
double-tell method, called the "raw event" method (SJAM is SoundJam's
creator code, BTW):
tell application "Finder"
set theApp to (the first process whose creator type is ("SJAM" as type
class)) as +class psn ;
set theAppName to name of (application file id "SJAM")
end tell
Now you can call the application in a number of ways:
tell theApp to get the player state -- normal syntax
...or even better:
tell theApp to get the +class pPlS; -- "raw event" syntax
(Watch for line wraps and chevron characters ;)
Questions?
HTH
JR