Re: Exists statements
Re: Exists statements
- Subject: Re: Exists statements
- From: John Stewart <email@hidden>
- Date: Tue, 22 Oct 2002 19:02:10 -0400
On 10/22/02 7:54 AM, "email@hidden"
<email@hidden>
wrote:
I'm writing a script that needs to determine if a certain file exists
or
not. I need to have it perform an action only if the file does not
exist.
This is where I'm running into problems. The code I have so far is:
tell application "Finder"
if {file "dpath" of folder "preferences" of folder "system folder"
of
startup disk exists} is "false" then choose folder with prompt
"Locate data
Folder"
There have been a couple of answers for this (pay close attention to
Paul's) but none that used the method I prefer -
try
"path:to:your:file" as alias
on error
choose file with prompt "Pick your file"
end try
note that you need to use -
"path:to:your:file" as alias -- will always
compile.
and not
alias "path:to:your:file" as alias -- may
generate compile error.
as the second version will not allow you to compile the script if the
file doesn't exist. The first example will compile correctly.
John
_______________________________________________
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.