• 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: Chris Garaffa <email@hidden>
  • Date: Wed, 10 Dec 2003 13:50:01 -0500

Hi Mark,

On Dec 10, 2003, at 1:06 PM, Redd, Mark wrote:

Hello all. Can anyone tell me if it is possible to return the folder, as
variable, that a script is currently residing in?

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

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


These won't work when a script is run in Script Editor, however.

--
Chris Garaffa
email@hidden
_______________________________________________
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: Walter Ian Kaye <email@hidden>
References: 
 >Folder question (From: "Redd, Mark" <email@hidden>)

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