Re: If exists logic
Re: If exists logic
- Subject: Re: If exists logic
- From: "Marc K. Myers" <email@hidden>
- Date: Fri, 6 Jun 2003 13:59:42 -0400
Subject: If exists logic
From: Jeff Grossman <email@hidden>
To: Applescript-Users <email@hidden>
How do I get the following code to work on OS X 10.2.6?
if (file "OSX:List Addresses:Fishads Addresses") exists then
tell application "Finder"
select {file "Fishads Addresses" of folder "List_Addresses" of
disk
"OSX"}
delete selection
end tell
end if
It does not seem to like my "if exists" line.
AppleScript doesn't understand the "file" object. It's a Finder
object. You could use the Finder to check for its existence or you
could do it this way, which is faster and requires fewer keystrokes:
set theFile to "OSX:List Addresses:Fishads Addresses"
try
alias theFile
tell app "Finder" to delete file theFile
end try
If theFile doesn't exist, execution will skip to the statement after
the "end try".
Marc [06/06/03 1:58:13 PM]
_______________________________________________
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.