• 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: Parent path. Senility?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parent path. Senility?


  • Subject: Re: Parent path. Senility?
  • From: Jolly Roger <email@hidden>
  • Date: Sun, 03 Dec 2000 18:39:24 -0600
  • Replyto: email@hidden

I use this one. It works on OS 8.5, 8.6 and OS 9, for text paths, aliases,
files, folders, etc.

return ParentFromPath(choose folder, true)

on ParentFromPath(thePath, wantPath)
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 (the number of text items in thePath) - 2
else
set idx to -2
end if
if wantPath then
set folderName to ((text items 1 through idx of pathAsList) as text)
& ":"
else
set folderName to item idx of pathAsList
end if
set AppleScript's text item delimiters to saveDelim
return folderName
end ParentFromPath

Enjoy.

JR


References: 
 >Parent path. Senility? (From: SemiColon <email@hidden>)

  • Prev by Date: Re: Contextual Menus in OS X?
  • Next by Date: Question
  • Previous by thread: Re: Does it presume too much [was Parent path]
  • Next by thread: Re: Parent path. Senility?
  • Index(es):
    • Date
    • Thread