Re: osascript - path to me
Re: osascript - path to me
- Subject: Re: osascript - path to me
- From: John W Baxter <email@hidden>
- Date: Mon, 20 May 2002 19:12:46 -0700
At 15:24 -0400 5/20/2002, Paul Skinner wrote:
>
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.
It has been pointed out to me off list that
path to
and
path to me
produce the same event (which the code below doesn't quite demonstrate...an
event capture would, but the AEPrint-format Apple Event log which follows
the three results--it's for the last form--is pretty convincing).
Here's an unsaved script:
{path to, path to me}
and its result.
{alias "Blake:Applications:Script Debugger 3.0:Script Debugger", alias
"Blake:Applications:Script Debugger 3.0:Script Debugger"}
Here is the result after the script is saved to a file (with Script
Debugger's optional "Path to me refers to document" hack turned on)
{alias "Blake:Users:john:Desktop:pathToTest", alias
"Blake:Users:john:Desktop:pathToTest"}
And with Script Debugger's hack turned off:
{alias "Blake:Applications:Script Debugger 3.0:Script Debugger", alias
"Blake:Applications:Script Debugger 3.0:Script Debugger"}
(Which looks remarkably like the unsaved case, as it should. ;-))
Log window in AEPrint format for the third case (with the alias record
contents elided):
Script "pathToTest" started
ascr\tell{
----:psn ($0000000000000002$),
&addr:psn ($0000000000000002$)
}
ears\ffdr{
----:'null'(),
&addr:psn ($0000000000000002$),
&subj:'null'(),
&csig:magn($00010000$)
}
--> alis($...$)
ears\ffdr{
----:'null'(),
&addr:psn ($0000000000000002$),
&subj:'null'(),
&csig:magn($00010000$)
}
--> alis($...$)
ascr\tend{
&addr:psn ($0000000000000002$)
}
Script "pathToTest" finished
(The key is that the subj thing and the direct object (the ---- thing) are
null in each case...the logged form of each event in AppleScript source
code is
path to current application
[ie, not either path to me or path to, but making it pretty clear what's up.)
Years and years ago, the recommendation on the MACSCRPT list (I don't think
this one existed yet) was that if you were doing
path to me
to obtain the parent directory to find resources, you should debug with the
script (and the resources) saved in the folder where Script Editor is
located.
I don't think that's reasonably possible in Mac OS X, or with application
bundle script editors in recent Mac OS 9 and slightly below, since the
Script Editor application isn't where it seems to be (my guess is you have
to break into the bundle...I would only try that with a COPY).
I'll repeat what I said before (I believe it more strongly after the
off-list message told me more about how things work), and add to it:
IF IT IS POSSIBLE (Script Debugger "cheats") to implement the ability, some
other command, such as
my path
should replace
path to me
for the purpose of finding resources co-located with the script. We should
leave
path to [me]
alone..."fixing" it to located co-located resources is bound to break some
scripts.
--John
--
John Baxter email@hidden Port Ludlow, WA, USA
_______________________________________________
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.