• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Referring to the local hard drive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: RE: Resize scripting with photoshop 5.0
  • Next by Date: RE: Photoscripter support
  • Previous by thread: Re: Referring to the local hard drive
  • Next by thread: Re: applescript-users digest, Vol 2 #179 - 6 msgs
  • Index(es):
    • Date
    • Thread