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: Jolly Roger <email@hidden>
- Date: Fri, 08 Dec 2000 20:31:55 -0600
- Replyto: email@hidden
on 12/8/2000 8:00 PM, email@hidden wrote:
>
In a message dated 12/8/00 8:29:28 PM,
>
email@hidden writes:
>
(snip)
>
>
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?
See below for an additional line (***) in the FilenameFromPath() handler
that fixes this problem.
>
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
You certainly can. Good catch.
Here's the revised handler:
on FilenameFromPath(thePath)
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 -2
--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
JR