Re: Relative path
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