Re: Parent path. Senility?
Re: Parent path. Senility?
- Subject: Re: Parent path. Senility?
- From: Jolly Roger <email@hidden>
- Date: Sun, 03 Dec 2000 18:39:24 -0600
- Replyto: email@hidden
I use this one. It works on OS 8.5, 8.6 and OS 9, for text paths, aliases,
files, folders, etc.
return ParentFromPath(choose folder, true)
on ParentFromPath(thePath, wantPath)
set thePath to (thePath as text)
set saveDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set pathAsList to text items of thePath
if the last character of thePath is ":" then
set idx to (the number of text items in thePath) - 2
else
set idx to -2
end if
if wantPath then
set folderName to ((text items 1 through idx of pathAsList) as text)
& ":"
else
set folderName to item idx of pathAsList
end if
set AppleScript's text item delimiters to saveDelim
return folderName
end ParentFromPath
Enjoy.
JR