• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
(no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(no subject)


  • Subject: (no subject)
  • From: jc <email@hidden>
  • Date: Wed, 15 Nov 2000 13:54:29 -0800

hello,
I get a bunch of downloaded text files every day. I have a master list of 100 files that may be downloaded. However, only 8 to 10 are downloaded per day. I have a question about how to handle items in a list that do not exist. In the following script, I try to delete each file in the list, but sometimes "file1", for example, will not be in the folder. An error crops up and stops the repeat loop before all the items in the list are tried. Is there any way to handle the error that crops up so that the repeat loop handles the error then simply goes on to try the next item in the list for existence and so on, for each item in the list? I guess I'm looking for a "resume" type of statement. I tried the Language Guide but didn't see anything relevant.

Thanks,
joan

tell application "Finder"
set i to 1
set FilesToDelete to {file "file1" of folder "JoansFolder" of startup disk, file ,
"file2" of folder "JoansFolder" of startup disk} as list
set FileCount to length of FilesToDelete
repeat with i from 1 to FileCount
try
delete item i in FilesToDelete
on error number errNum
if errNum = -1728 then
display dialog "Joan screwed up again. The error ,
number is: " & errNum buttons {"AAAHHH!"}
end if
end try
end repeat
end tell


  • Prev by Date: Re: Date of next Thursday
  • Next by Date: Re: Applescripting to Photoshop plug-in
  • Previous by thread: Re: Applescripting to Photoshop plug-in
  • Next by thread: RE: (no subject)
  • Index(es):
    • Date
    • Thread