Re: Calling an application
Re: Calling an application
- Subject: Re: Calling an application
- From: "Marc K. Myers" <email@hidden>
- Date: Fri, 09 Feb 2001 17:15:39 -0500
- Organization: [very little]
>
From: email@hidden
>
To: email@hidden
>
Subject: Calling an application
>
Date: Fri, 9 Feb 2001 10:36:54 -0600
>
>
Sorry for the basic question, but I never really learned how to do this. I have a script that launches (or tries to launch) Apple Software Restore. If I just write:
>
>
tell application "Apple Software Restore"
>
>
it would prompt me to locate it, so I wrote:
>
>
tell application "ASR:ASR:Apple Software Restore"
>
>
where ASR is the name of the disk, and a folder at the root of the harddrive which contains the app.
>
>
There are still about 10% of the machines that this script is running on that cannot find it without somebody pointing to it manually. Why does this happen, and what is the proper way to get around this?
Find out what the signature (Creator Type) for Apple Software Restore
is. For this example we'll say it's "ASRe". Than call the app like this:
tell application "Finder"
set appPath to application file id "ASRe" as string
set appName to name of application file id "ASRe"
end tell
launch application appPath
tell application "Apple Software Restore"
tell application appName
[Do Stuff]
end tell
end tell
For a number of reasons, the system can find it hard to locate a program
by its name. It can (almost) always find it by it's signature. The
extra layer of "tell...end tell" with the application's name is there so
the compiler can know what application it's compiling the commands for.
It should have no effect at run time.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[2/9/01 4:08:22 PM]