Re: "path to me" vs ":"
Re: "path to me" vs ":"
- Subject: Re: "path to me" vs ":"
- From: JJ <email@hidden>
- Date: Sat, 08 Dec 2001 22:40:34 +0100
>
A simple means of replacing the ":" trick with "path to me" when you want
>
the path to the enclosing folder is:
>
>
set myalias to (path to me)
>
tell application "Finder"
>
set mypath to folder of myalias
>
end tell
>
set mypath to mypath as string
>
>
This is shorter than using Text Item Delimiters to lop off the end of the
>
path, and has the advantage of not assuming the path delimiter.
So, in an old discussion, the problem was when the parent isn't the script
itself. For example, if you're using standard additions and 1 app, and you
define this app as the parent, "path to me" will never return the path to
the running app.
This stupid script demonstrates it:
property parent : application "URL Access Scripting"
set myalias_1 to (":" as alias)
display dialog myalias_1
-- returns path to container of the running app
set myalias_2 to (path to me)
tell app "Finder"
set mypath to folder of myalias_2
end tell
display dialog mypath
-- returns path to container of "URL Access Scripting"