Re: Folder question
Re: Folder question
- Subject: Re: Folder question
- From: Walter Ian Kaye <email@hidden>
- Date: Wed, 10 Dec 2003 11:52:36 -0800
At 01:50p -0500 12/10/2003, Chris Garaffa didst inscribe upon an
electronic papyrus:
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
Or to use the Finder:
set myAlias to path to me
tell app "Finder" to set myFolderPath to container of myAlias as
alias as string
(* include the 'as alias' if you want the trailing colon *)
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
Or to use the Finder:
set myAlias to path to me
tell app "Finder" to set myFolderName to name of myAlias
-boo
_______________________________________________
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.