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

Re: Relative path


  • Subject: Re: Relative path
  • From: Nigel Garvey <email@hidden>
  • Date: Wed, 20 Dec 2000 23:47:51 +0000

Matt Sainson wrote on Wed, 20 Dec 2000 11:40:52 -0800:

>I'm trying to get the path to a file that is relative to the path to the
>script that is running. I understand the use of "me" however, in tinkering
>around, I can't seem to get the folder of "me", and subsequently the parent
>folder of that folder and etc. Is this something that is managed through
>string manipulation of path names of can it be done with finder commands?

In a similar discussion a few months ago, someone pointed out that you
can get the path to the folder of the application running the script
quite simply like this:

"" as alias

or:

":" as alias

The more colons you put in the string, the further up the folder
hierarchy you go - until eventually you get an error. I don't know why
this works, or even if it's supposed to.

For your purposes, you'd probably want something like:

set filePath to (":" as alias as string) & "A nearby file"

or even:

set filePath to alias ((":" as alias as string) & "A nearby file")


<;-)>
If you were in a silly mood, you might try something like this:

tell AppleScript
words of "What's my folder, please?"
end tell
display dialog result's {item 2, item 3} as string as alias as string

</ ;-)>

NG


  • Prev by Date: Re: Run Only
  • Next by Date: Re: Relative path (Jolly Roger)
  • Previous by thread: Re: Relative path
  • Next by thread: Akua Sweets (was Re: Simple 'screensaver' launcher)
  • Index(es):
    • Date
    • Thread