Re: Folder question
Re: Folder question
- Subject: Re: Folder question
- From: Chris Garaffa <email@hidden>
- Date: Wed, 10 Dec 2003 13:50:01 -0500
Hi Mark,
On Dec 10, 2003, at 1:06 PM, Redd, Mark wrote:
Hello all. Can anyone tell me if it is possible to return the folder,
as
variable, that a script is currently residing in?
If you want the full path, try this:
set myPath to path to me as text
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set myPath to every text item of myPath
set myPath to items 1 through ((count myPath) - 1) of myPath as string
--myPath is now the path, for example "drop:Users:cgaraffa:Desktop"
set AppleScript's text item delimiters to oldTIDs
Otherwise, if you just want the name of the parent folder, try:
set myPath to path to me as text
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set myPath to every text item of myPath
set myPath to item ((count myPath) - 1) of myPath
--myPath is now the parent folder, for example "Desktop"
set AppleScript's text item delimiters to oldTIDs
These won't work when a script is run in Script Editor, however.
--
Chris Garaffa
email@hidden
_______________________________________________
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.