Re: Use an app by path
Re: Use an app by path
- Subject: Re: Use an app by path
- From: Christopher Nebel <email@hidden>
- Date: Thu, 21 Feb 2002 09:51:18 -0800
On Thursday, February 21, 2002, at 06:14 AM, Serge Belleudy-d'Espinose
wrote:
This sounds really simple but for now I can't seem to remember how to
write this pseudo-code:
tell application "path of app as string"
do thing
end
This is for a generic applet, so don't tell me about the trick with
creator code since it won't work. So, is it possible to tell an app by
path w/o having the stupid 'where is app?' dialog?
Yes, with a caveat or two. As of AppleScript 1.4, if you say 'tell
application "full:path:here"', AppleScript will assume you know what
you're talking about and will throw an error if there's no application
there instead of asking you where it is. This applies whether the path
string is literal or comes from a variable.
Obviously, if you use a literal path string, it's only going to work on
your machine. If you don't mind that, though, then it's the simplest
way to go.
If you're using a variable for the path (so the tell looks something
like "tell application myPathString"), then you can only use standard
terminology inside the tell, since AppleScript can't tell at compile
time where to look for terms. To get around this, you can use
double-tell, raw event codes, or "using terms from". However, since the
target application is an applet, it doesn't have any terms of its own,
so you don't need to bother -- just call the handlers normally.
Then there's the problem of how to produce the path string in the first
place. Since it's an applet, you don't have a unique creator code, so
you'll have to use either a completely fixed location or something
relative to the running script. "path to me" will probably be helpful.
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.