Re: Testing for files and/or folders
Re: Testing for files and/or folders
- Subject: Re: Testing for files and/or folders
- From: "Serge Belleudy-d'Espinose" <email@hidden>
- Date: Thu, 7 Mar 2002 01:35:16 +0100
At 12:55 -0700 6/03/02, Michelle Steiner wrote:
When testing to see if a file or folder exists, do not use this
structure:
if exists (alias "diskname:foldername:filename")
The reason is that the compiler will attempt to resolve the alias at
compile time, and if it can't find it, it will display an alert.
Right, but you can use a variable:
set sPath to "diskname:foldername:filename"
if exists (alias sPath)
The compiler will not bark at this one. And you don't need 'exists'
which is a Finder command, just a try block:
try
alias sPath
-- do thing if sPath exists
on error
-- do thing if sPath doesn't exist
end try
Btw, isn't that the alias construct that leaks, shouldn't we use instead
sPath as alias
Emmanuel please?
Serge
--
\\//\//\// Serge Belleudy-d'Espinose Institut Jacques Monod - Jussieu
// // //
http://www.ijm.jussieu.fr/ Universites Paris VI, VII - CNRS
//\//\//\\
_______________________________________________
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.