steveurich
asked on
Apple script called by Hazel fails
Here is the Script courtesy of Brooks Duncan at Document Snap and MacSparky.
I have run it on about 500 files and it mostly runs OK but it has failed about 30 times. Do you think that the delay needs to be increased? Is there anywhere to look for why it failed?
tell application "PDFpenPro"
open theFile as alias
tell document 1
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
end tell
end tell
I have run it on about 500 files and it mostly runs OK but it has failed about 30 times. Do you think that the delay needs to be increased? Is there anywhere to look for why it failed?
tell application "PDFpenPro"
open theFile as alias
tell document 1
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
end tell
end tell
ASKER
I set them both to 10 and have not had any errors but it is taking a long time to even process a 2 page PDF.
Not sure which timer loop is doing what.
Is the first loop telling PDFPen to do the next page?
Is the second loop waiting to save the document?
Thanks,
Steve
Not sure which timer loop is doing what.
Is the first loop telling PDFPen to do the next page?
Is the second loop waiting to save the document?
Thanks,
Steve
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for the help.
The script has a 1 second loop while performing the OCR which checking if the OCR completed every second .. I'd suggest you increase the interval to 5 or 10 seconds at least between checks
The second delay waits 1 second after the ocr stops to close and save ... again if you increase to a slightly longer period it might avoid any issues with taking longer to save the file
If you increase the delays and re-test on the files that failed .. you should see if it improves the issue and reduces the failure rate.