Re: Folder name from alias
Re: Folder name from alias
- Subject: Re: Folder name from alias
- From: Jolly Roger <email@hidden>
- Date: Fri, 08 Dec 2000 16:28:51 -0600
- Replyto: email@hidden
on 12/7/2000 11:48 PM, Rick Plummer wrote:
>
I need script that will extract the folder name of a folder
>
dropped on an applet (for use later inthe script).
Way faster and more reliable than "info for":
on open {theItem}
display dialog FilenameFromPath(theItem)
end open
on FilenameFromPath(thePath)
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) - 1
else
set idx to -1
end if
set folderName to item idx of pathAsList
set AppleScript's text item delimiters to saveDelim
return folderName
end FilenameFromPath
Enjoy.
JR