Under certain circumstances, my folder action doesn’t work properly:
on adding folder items to thisFolder after receiving addedItems
repeat with anItem in addedItems
tell application “Finder”
if name of file anItem contains “.ps” then
do shell script "pstopdf " & quoted form of POSIX path of anItem
end adding folder items to
This folder action should convert any postscript file dropped inside my folder to a PDF file. It does this job very well as long as while processing a couple of files, there are no new files dropped. As an example: I drop 5 postscript files and while processing the second one (I can see already the first generated PDF file) I drop 5 more files. At this moment, the folder action will “forget” about files 3, 4 and 5 from first round and will continue with second round dropped files. Those “forgotten” files will never be processed!
The only reason why my shown folder action script is using the “pstopdf” command is because it takes some time to process the files, so I can drop new ones while processing. You can replace that command with anything else that requires some time processing and will notice the same files “not processed”.
This is not an issue about how to convert postscript files to PDF, it is about folder actions not processing ALL files!
Any idea on how to avoid this kind of problems?