• 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: opening parent folder....
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: opening parent folder....


  • Subject: Re: opening parent folder....
  • From: JollyRoger <email@hidden>
  • Date: Wed, 27 Feb 2002 08:15:53 -0600

I'm not sure how efficient "::" was anyway. I use the following handler.
It's quite fast. (The same note about running in a script editor applies.)

-- begin script
display dialog ParentFromPath(path to me, 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
-- end script

HTH

JR

On 2/26/2002 11:00 PM, "email@hidden" <email@hidden> wrote:

> In MacOS 9.1 and earlier, you could use
>
> set parentFolder to "::" as alias as string
>
> Note that if you run this in Script Editor, you will get the path of the
> folder which encloses the folder containing Script Editor. To observe the
> behavior you want, you will need to save your script as an application and
> run it.
>
> Sadly, Apple broke this in 9.2 and OSX. Anyone have any answers for those OSs?
>
> Jeff Baumann
> email@hidden
> www.linkedresources.com
>
>
>
> In a message dated 2/26/02 6:55:11 PM, fearghal wrote:
>
>> sorry if this is a resend - not sure if it made it through the first
>> time...
>>
>> ok, i'm fairly new to applescript and have a questions for the veterans...
>>
>> i have a folder called "INSTALLER" and inside that i have a folder called
>> "SCRIPTS", inside scripts i need to have an applescript that will open the
>> folder "INSTALLER"... to make matters complicated, the folder will not
>> always be called "INSTALLER" - it may have a different name and also the
>> location of the folder may vary.. this means that i have to get the path and
>> the name of the folder dynamically at the start of the script and then use
>> them to open the folder.
>>
>> any advice?
>>
>> thanks in advance!
>>
>> fearghal
>>
>> j|
_______________________________________________
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.

References: 
 >Re: opening parent folder.... (From: email@hidden)

  • Prev by Date: Re: Beginners drop folder
  • Next by Date: Running Script as root using Sudo
  • Previous by thread: Re: opening parent folder....
  • Next by thread: Re: opening parent folder....
  • Index(es):
    • Date
    • Thread