Does anyone have a Hazel-pdf pen-OCR script that still works?

Mine doesn’t work anymore. I’d appreciate your posting a working copy, if you have one.

I have moved the same script from PDF Pen Pro to Nitro PDF Pro (also in Setapp), and it works.

PDF Pen Pro old version somehow stopped working.

I’m using the new version along with MacSparky’s script, but it doesn’t work either. It moves the file to the proper folder but does not perform the OCR.

When I moved my pdf back to Dropbox everything worked again.

While I haven’t had my OCR script fail, I did discover that because Spotlight indexing of new files is not instantaneous you may not find a “content contain” match immediately. I’ve had to use “content contain match”, which doesn’t use Spotlight in these cases.

If your OCR script has “get the needs ocr of document 1” in it, it seems that no longer works. comment out the line and change the next line to “if true then”.
It’s not a perfect fix since it will ocr previously ocred documents, but that is what an older script did.

The older script:

tell application "PDFpenPro"
	open theFile as alias
	tell document 1
		repeat while performing ocr
			delay 1
		end repeat
		delay 1
		close with saving
	end tell
	tell application "PDFpenPro"
	end tell
end tell

Of course replace PDFpenPro with Nitro PDF Pro to use the Nitro version.