RE: Referring to the local hard drive
RE: Referring to the local hard drive
- Subject: RE: Referring to the local hard drive
- From: "Goodman, Steve" <email@hidden>
- Date: Fri, 5 Jan 2001 10:44:37 -0600
>
on shortenName(longPath)
>
set AppleScript's text item delimiters to {":"}
>
if last character of longPath is ":" then -- it's a folder
>
set itemCount to (count text items in longPath) - 1
>
-- last text
>
item is ""
>
set shortName to the text item itemCount of longPath
>
else -- it's a file
>
set shortName to the last text item of longPath
>
end if
>
return shortName
>
end shortenName
Don't forget to set your text item delimiters back:
on shortenName(longPath)
set olddelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
if last character of longPath is ":" then -- it's a folder
set itemCount to (count text items in longPath) - 1 -- last text
item is ""
set shortName to the text item itemCount of longPath
else -- it's a file
set shortName to the last text item of longPath
end if
set AppleScript's text item delimiters to olddelims
return shortName
end shortenName
Steve Goodman
Vertis - THE LTC GROUP
......."Duct tape is like the force, it has a light side and a dark side and
it holds the universe together."------Unknown