- Code: Select all
tell application "PDFpenPro"
delay 5
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
This works fine unless I get an encrypted pdf. In that case the applescript fails but the "ocr" tag still gets added to the file. So what I want to do is, that if the OCR of the file fails, I want to run the file through a decryption rule with PDFKey Pro.
So first idea was to include the tag into the script instead of just adding it as second action of the hazel rule, but I couldn't figure out how to add the "orc" tag inside the apple script.
- Code: Select all
tell application "Finder"
delay 5
set tags of theFile to item "ocr"
end tell
Is there a way to tell hazel to stop with the current rule and proceed with the next one, or alternatively to add a tag if the rule/script fails? Or could anyone expand the embedded applescript to just add the "ocr" tag after successful completion of the OCR part?