Re: Why doesn't 'alias' error when the file no longer exists?
Re: Why doesn't 'alias' error when the file no longer exists?
- Subject: Re: Why doesn't 'alias' error when the file no longer exists?
- From: "Eric Grant" <email@hidden>
- Date: Mon, 18 Dec 2000 11:19:25 -0800
- Organization: http://www.eagrant.com
Paul Berkowitz <email@hidden> wrote:
>
The test that works is:
>
>
try
>
get alias (theFile as string)
>
on error
>
display dialog "Squawk!"
>
end try
>
>
That must force the script to try to resolve (is that the word?) the alias
>
afresh. If it exists, all is well, if it doesn't, the error trap works.
>
Why does it give the result
>
>
get theFile
>
-- alias "Hard Disk:Some Folder:Some File"
>
>
when there is no such thing?
In general, just "getting" a variable does nothing -- it is a literally
useless action. So, as you surmised, "getting" an alias does not resolve
the alias. You must actually use the alias (such as by coercing it to a
string) for it to be resolved.
Cheers,
Eric