Hi, I’ve been cobbling together a Folder Action to print and delete files that arrive in a certain folder. I thought I had it cracked but each time it completes it seems to delete the folder action itself and so the next file doesn’t print until I’ve manually re-enabled Folder Actions. I’m not a profficient scripter and only just understand how this script works, but it seems that what I’m deleting is only the file that printed, so can anybody point out my mistake?.. please!
on adding folder items to thisFolder after receiving addedItems
set myPrinter to "Deskjet_5900_series"
set myFiles to list folder thisFolder without invisibles
repeat with x from 1 to count myFiles
set thisPath to POSIX path of file (thisFolder & (item x of myFiles) as string)
set theShell to "lpr -P " & myPrinter & " " & thisPath
try
do shell script theShell
on error err
end try
set theShell2 to "rm " & thisPath
try
do shell script theShell2
end try
end repeat
delete addedItems
end adding folder items to
Model: Mac Dual 2.7 GHz PowerPC G5
AppleScript: 1.10.7
Browser: Safari 419.3
Operating System: Mac OS X (10.4)