Re: How to resolve an alias in a path?
Re: How to resolve an alias in a path?
- Subject: Re: How to resolve an alias in a path?
- From: Paul Berkowitz <email@hidden>
- Date: Wed, 12 Sep 2001 21:24:20 -0700
On 9/12/01 8:18 PM, "Taylor Leaming" <email@hidden> wrote:
>
What is the best way to handle a path that includes an aliased folder?
>
>
I have a number of scripts that use paths where the target files have been
>
moved. Rather than find and edit all these scripts with the new and now
>
much longer path, I wanted to instead add some folder aliases with short
>
names.
>
>
For example, this might the old path with no aliased folders in it:
>
>
"MacBert:Development:projectN:"
>
>
would have become:
>
>
"MacBert:Applications (Mac OS 9):Development:projectN:"
>
>
but I'd like to use something like
>
>
"MacBert:Dev:projectN:"
>
^^^
>
alias to "MacBert:Applications (Mac OS 9):Development:"
>
>
But while Script Editor will "check syntax" okay, it gives an execution
>
error "Folder MacBert:Dev:projectN: wasn't found"
>
>
How do I get this to work?
>
Simple. Don't save the paths nor refer to them . save the actual alias as a
script property. Then you can rename them , move the, do anything to them
except flush them down the trash and the script will find them.
Like this:
property theFile : "'
if theFile = "" then
set theFile to choose file with prompt "OK, find that file!"
end if
Or, if there's no mystery about it, and it's just for your own computer:
property theFile : alias "MacBert:Development:projectN:"
Either way, you can do whatever you want with that file unless you recompile
the script. As long as you're simply running the script and not recompiling
it in a script editor, it will find that file no matter how you disguise it.
But you must declare it as a property, which is persistent, at the top of
the script.
--
Paul Berkowitz