Re: applescript-users digest, Vol 2 #113 - 11 msgs
Re: applescript-users digest, Vol 2 #113 - 11 msgs
- Subject: Re: applescript-users digest, Vol 2 #113 - 11 msgs
- From: email@hidden
- Date: Fri, 8 Dec 2000 21:00:14 EST
In a message dated 12/8/00 8:29:28 PM,
email@hidden writes:
>
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
I tried to run this script and I get an error "Can't get every text item of
alias (somefolder)" which errors on the line:
set pathAsList to text items of thePath
I'm on OS 8.6. Is this new language for OS 9?
Also, just curious...
Instead of:
set idx to (the number of text items in thePath) - 1
can't you just say:
set idx to -2
Ken Fleisher
email@hidden