Re: osascript - path to me
Re: osascript - path to me
- Subject: Re: osascript - path to me
- From: Paul Skinner <email@hidden>
- Date: Mon, 20 May 2002 15:24:15 -0400
On Monday, May 20, 2002, at 05:10 AM, Dennis W. Manasco wrote:
Maybe I'm missing something but...
It makes no sense for 'me' to refer to anything other than the entity
asking the question.
Ah, but who is the entity asking the question? Per the ASLG the
script executing the 'me' command is the entity. This has nothing to do
with any file system.
display dialog (name of me) as text
-->script debugger (helpful option turned off)
script childScript
display dialog (name of me) as text
end script
run childScript
-->childScript
run script "run zombie" & return & "script zombie" & return & "display
dialog (name of me) as text" & return & "end script"
-->zombie
In any nominally English-language syntax 'path to me' should be
interpreted as, "What is my corporeal location? Please return this
path."
Not according to the current code base or documentation. You might
as well say that Applescript should interpret 'Path to success' as 'What
is happiness? Please take me there." It just isn't so.
The core of this debate is really about what the function of the
'me' property should be. Is it where the code is running or where the
source file for the running code is stored on the filesystem. The
property has already been defined. It's the first one. The 'Path to'
applied to this property is doing what it's designed to do. It is
telling you the path to the application that is running the code.
But a command that consistently delivers the path to the source
code of the running script (if it exists) would be very useful.
It makes no more sense for 'path to me' to return the path to the
program executing the script than it does for 'path to me' to return,
"The computer in Bob's room."
Suppose you wanted to quit all applications. So you make a script
that gets all the processes and repeats through them quitting them. But,
you don't want the script to kill itself until it has killed the other
processes. Now which process is the script running in? How else could
you know that it is the System:library:CoreServices:SystemUIServer.app
that is running the script if 'path to me' doesn't tell you? (In the
case of a script running from the scripts menu.)
What about scripts that haven't been saved? They should receive either
an error condition or a null path.
What about the same scenario as above but run from the editor? How
would you know the Script Editor shouldn't be quit until last?
IMO a new argument for 'Path to' (such as 'source file') would be a
better solution than breaking 'me' just for 'Path to me' to return the
path to the executing script's source file consistently.
-=-Dennis
--
Paul Skinner
_______________________________________________
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.