error handler

So I have this script that is attached to a folder action that prints an item in illustrator when a item is added to

My problem is files are being put into this folder randomly and often when the script is running a new item gets added to the folder and disrupts everything. I cant figure out how to make it so the script doesnt get bothered and all items get printed. Also I cant figure out how to make it ignore the RESORCE.FRK folder and a .dat file that comes
into the folder

Thanks all for any input.:smiley:

   set theList to {}
   
   repeat with an_item in these_items
       set end of theList to name of (info for an_item) as string
   end repeat
   
   repeat with listItem in theList
       --display dialog listItem
   end repeat
   
   
   
   tell application "Adobe Illustrator 10"
       --set user interaction level to never interact
       activate
       repeat with an_item in these_items
           set end of theList to name of (info for an_item) as string
           open an_item --with options {update legacy text:true}
           delay 1
           print document 1 without dialog
           
           close document 1 saving no
       end repeat
   end tell
   
end adding folder items to