• 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: Folder question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folder question


  • Subject: Re: Folder question
  • From: Walter Ian Kaye <email@hidden>
  • Date: Wed, 10 Dec 2003 11:52:36 -0800

At 01:50p -0500 12/10/2003, Chris Garaffa didst inscribe upon an electronic papyrus:

If you want the full path, try this:
set myPath to path to me as text
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set myPath to every text item of myPath
set myPath to items 1 through ((count myPath) - 1) of myPath as string
--myPath is now the path, for example "drop:Users:cgaraffa:Desktop"
set AppleScript's text item delimiters to oldTIDs

Or to use the Finder:
set myAlias to path to me
tell app "Finder" to set myFolderPath to container of myAlias as alias as string
(* include the 'as alias' if you want the trailing colon *)

Otherwise, if you just want the name of the parent folder, try:
set myPath to path to me as text
set oldTIDs to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set myPath to every text item of myPath
set myPath to item ((count myPath) - 1) of myPath
--myPath is now the parent folder, for example "Desktop"
set AppleScript's text item delimiters to oldTIDs

Or to use the Finder:
set myAlias to path to me
tell app "Finder" to set myFolderName to name of myAlias


-boo
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Folder question
      • From: Emmanuel <email@hidden>
References: 
 >Folder question (From: "Redd, Mark" <email@hidden>)
 >Re: Folder question (From: Chris Garaffa <email@hidden>)

  • Prev by Date: Re: Folder question
  • Next by Date: Re: BBEdit Language module?
  • Previous by thread: Re: Folder question
  • Next by thread: Re: Folder question
  • Index(es):
    • Date
    • Thread