Re: How to Test for a file ...
Re: How to Test for a file ...
- Subject: Re: How to Test for a file ...
- From: Laine Lee <email@hidden>
- Date: Thu, 01 Jul 2004 12:40:19 -0500
>
Hello,
>
I was wondering if anyone could tell me how to test if a file exists?
>
So, if it does not I can create the file.
Here's one way, assuming you use OS X and TextEdit is in your Applications
folder.
------------
set posix_item_in_question to "/Applications/Regretit.app"
repeat
set hfs_textedit to (POSIX file posix_item_in_question)
try
get hfs_textedit as alias
exit repeat
on error
display dialog "Did you mean \"TextEdit\"
instead of
\"Regretit\"?
" buttons {"Cancel", "Of Course I did!"} default button 2
if button returned of result is "Of Course I did!" then
set posix_item_in_question to "/Applications/TextEdit.app"
end if
end try
end repeat
do shell script "/usr/bin/open " & posix_item_in_question
------------
--
Laine Lee
email@hidden
http://lonestar.utsa.edu/llee
_______________________________________________
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.