Re: Where am I?
Re: Where am I?
- Subject: Re: Where am I?
- From: "Arthur J Knapp" <email@hidden>
- Date: Sun, 01 Apr 2001 12:26:59 -0400
>
Date: Sun, 01 Apr 2001 15:48:37 +1000
>
Subject: Where am I?
>
From: Nick Quinn <email@hidden>
>
... I
>
would like simply to put the script in that folder and let it do something
>
like:
>
>
set pathToScript to the path of this script
>
>
Then fiddle with the text to get the folder path. This obviously doesn't
>
work.
If you are using Apple's Script Editor, the thing to remember is that
"path to me" is going to refer to the Editor while you are debugging,
but will refer to the script when it is run as a script application.
set scriptAppPath to path to me
--
-- > file "MacHD:Fold:My Script"
set scriptAppFolder to scriptAppPath as string
set text item delimiters to {":"}
set scriptAppFolder to text items 1 thru -2 of scriptAppFolder
set scriptAppFolder to (scriptAppFolder as string) & ":"
set text item delimiters to {""}
scriptAppFolder
--
-- > "MacHD:Fold:"
This may be a good time to bring out the old "single-line folder
path to me" snippit, (just for fun):
-- Please watch for line breaks:
set s to path to me
("" & s)'s text 1 thru -(offset of ":" in ("" & ("" & s)'s items's reverse))
-- OR
("" & (path to me))'s text 1 thru -(offset of ":" in ("" & ("" & (path to
me))'s items's reverse))
I think that most of the third-party script editors have some provision
for ensuring that "path to me" refers to the script document being edited.
Script Debugger has a preference setting for this.
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://home.earthlink.net/~eagrant/