Automator & PDFPen Applescript for Batch OCR

If you need batch OCR for PDF files and own a Mac than here is the script that saves your life 😉

First you have to make sure that PDFPen ist installed on your Mac.

Second, just create an Automator Workflow as a „Service“. Make sure you select, that it processes „files and folders“ and add „Run Applescript“ to it. Then paste the script into the „Run Applescript“ section. Make sure you have cleared the section, otherwise you will end up with two run statements 😉

AutomatorOCRScript
Here ist the script for copy&paste…

on run {input, parameters}
set myCount to count input
repeat with i from 1 to number of items in input
set this_item to item i of input
tell application "PDFpen 7"
open this_item
tell document 1
ocr
repeat while performing ocr
delay 1
end repeat
delay 1
close with saving
end tell
end tell
end repeat
tell application "PDFpen 7"
quit
end tell
end run

Now save the Automator Workflow as a Service and it will be available in the context menu in finder. Now select the files you want to OCR and have fun…

Advertisements