Re: (no subject)
Re: (no subject)
- Subject: Re: (no subject)
- From: jc <email@hidden>
- Date: Fri, 17 Nov 2000 13:19:04 -0800
I think that's the reverse of what jc was asking for, but it's on the right
track. Try...on error statements let you catch errors; what you do with them
after that is the interesting part. Steve's example will exit the
loop cleanly
if any errors occur, but remaining items won't get processed. If you want to
ignore the error completely, don't do anything in the "on error" part, like
Hello,
The strange thing is, steve goodman's solution did exactly
what I wanted it to do. It did not exit cleanly, instead, it resumed
the loop and went on to the next item on the list.
I read and reread the AS Language Guide before coming to the
list for help, and after Steve Goodman's suggestion, reread it again.
I came to the conclusion that Steve Goodman's solution was a
creative interpretation of its function. I originally assumed that
the on error statement would handle any errors and let the repeat
loop go on to the next item on the list, but for some reason it
doesn't work. The moment I added the "exit repeat" it worked.
here is a very truncated version of my script(only 2 list items
instead of 100). perhaps there is something weird in this script
that causes this phenomenon? i'm a newbie after all.
thanks,
joan
tell application "Finder"
set i to 1
set FilesToDelete to {file "file1" of folder "JcFolder" of
startup disk, **
file "file2" of folder "JcFolder" of startup disk}
set FileCount to length of FilesToDelete
repeat with i from 1 to FileCount
try
delete item i in FilesToDelete
on error
exit repeat
end try
end repeat
end tell