Re: If folder does not exist ...
Re: If folder does not exist ...
- Subject: Re: If folder does not exist ...
- From: Steven Angier <email@hidden>
- Date: Wed, 12 Jun 2002 09:56:22 +1000
On 12/6/02 9:29 AM, "JollyRoger" <email@hidden> wrote:
>
on FileExists(someFile)
>
try
>
set anAlias to (someFile as alias)
>
return true
>
on error
>
return false
>
end try
>
end FileExists
>
--end script
That's good, except that FileExists() might fail if you feed it an alias
instead of a path string. (A broken alias is still an alias.)
If you add a text coercion before the alias coercion, then feeding it a
broken alias will return the right result, thus:
on FileExists(someFile)
try
get (someFile as text) as alias
return true
on error
return false
end
end
>
>
In many cases, asking the Finder to do something is much, much slower than
>
the alternative.
And often less reliable.
Steven Angier
Macscript.com
_______________________________________________
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.