• 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: applescript-users digest, Vol 2 #795 - 15 msgs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: applescript-users digest, Vol 2 #795 - 15 msgs


  • Subject: Re: applescript-users digest, Vol 2 #795 - 15 msgs
  • From: "Marc K. Myers" <email@hidden>
  • Date: Sat, 23 Jun 2001 10:22:39 -0400
  • Organization: [very little]

> Message: 1
> Date: Fri, 22 Jun 2001 11:56:39 -0600
> To: "Gary B. Little" <email@hidden>,
> <email@hidden>
> From: Bill Peters <email@hidden>
> Subject: Re: What the "tell" is going on?
>
> At 7:13 AM -0700 6/22/2001, Gary B. Little wrote:
> >Does anyone know the algorithm the tell statement uses to locate an
> >application at run time?
> >
> >Here's my problem. I've got a Fetch-related script that was compiled when
> >the old Fetch 3.0.3 was one my system. When I upgraded to Fetch 4 and
> >removed Fetch 3.0.3, the script now asks me "Where is Fetch?" even though
> >the creator type for Fetch has not changed. Strangely, it even asks me when
> >Fetch 4 is already running.
> >
> >Although I can easily recompile the script on my own system, I'd like the
> >script to work properly regardless of the version of Fetch that someone who
> >may run my script may have on their system.
> >
> >How does the tell statement work? Why can't it just look in to the desktop
> >database to determine where the application is located. I've got a Launch
> >Application osax that does just that and it works just fine.
> >
> >Gary
>
> I ran into the same problem in an application I was scripting. I don't have
> a solution when some version of the application is not already running, but
> this will work when it is:
>
> tell application "Finder"
> -- beware of the chevrons around "class psn "
> set theProcess to (first process whose creator type is "FTCh") as +class
> psn ;
> end tell
>
> using terms from application "Fetch 3.0.3"
> tell theProcess
> -- do something cool
> end tell
> end using terms from

Since "using terms from" works only in the most recent versions of
AppleScript it might be a more "general purpose" solution to grab a path
to the executing copy of Fetch and use that in a "tell" statement:

tell application "Finder"
set theProcess to (some process whose creator type is "FTch") as
<<class psn >>
set theFile to (file of process (theProcess as text)) as text
end tell

tell application theFile
-- do something terribly clever
end tell

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[6/23/01 10:19:18 AM]


  • Prev by Date: Re: Creating a folder hierarchy from variables.
  • Next by Date: FaceSpan Frustrations (deployment)
  • Previous by thread: Re: Creating a folder hierarchy from variables.
  • Next by thread: FaceSpan Frustrations (deployment)
  • Index(es):
    • Date
    • Thread