• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Reliably calling an application within Handlers
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Reliably calling an application within Handlers (From: Bill Cheeseman <email@hidden>)

  • Prev by Date: Re: move font file from font folder
  • Next by Date: App switcher in OS 9
  • Previous by thread: Re: Reliably calling an application within Handlers
  • Next by thread: Re: Ok now that I've got MacOS X
  • Index(es):
    • Date
    • Thread