PDF workflow... HELP!

Hi All,

I’m hoping that one of you amazing people can help me figure this out. This should be easy!

I am trying to create a workflow that does three things:

  1. Gets FineReader OCR Pro to perform OCR on a file
  2. Copies the OCRed file to a new location
  3. Deletes the original file

I tried to create an Automator folder action to do this, but it wouldn’t delete the original file. (When I used the “Move Finder Items to Trash” action, it trashed the new, OCRed file but did nothing with the original file).

What would you recommend? Should I try modifying the Automator folder action somehow? Use another tool?

Thanks so much!

Ps I have Keyboard Maestro and Hazel and I’m running the latest of everything

It might help if you shared your Automator workflow. My guess is that you had set it to trash the output rather than trash the original.

Given you had it partially working, I guess you might have a bit of AppleScript to do the OCR. I don’t have “FineReader OCR Pro” (did you mean “ABBY FineReader PDF”? … though I also don’t have that either so I don’t have the AppleScript dictionary to figure out what would do the OCR), but the idea would be to set the output to your desired location as part of that script.

Bing Chat's stab at creating some AppleScript for ABBY FineReader PDF...

I have no idea if this works, but just in case, here’s some generated code that may be viable or help amend whatever you may already have/

on run argv
    set pdfPath to item 1 of argv
    set outputPath to (path to documents folder as text) & "OCR'd_" & (name of (info for pdfPath)) & ".pdf"
    tell application "ABBYY FineReader PDF"
        open pdfPath
        tell document 1
            ocr
            repeat while is busy
                delay 1
            end repeat
            save to outputPath
            repeat while is busy
                delay 1
            end repeat
        end tell
        quit
    end tell
end run

So your algorithm would be …

  1. OCR the file, outputting the OCR’d PDF to the desired location (rather than the same location).
  2. Move the original file to the trash.

Hazel is an ideal tool for this, so maybe something like this could be done:

2024-01-20-21.27.08

If you really want to generate the file in the same location and have Hazel move it around, you could do things like adding a colour label to the PDF, and excluding it from this rule, and creating another rule that only processes files with the specified colour label. But if you can write once to the final destination, that is the most efficient option.

Hope that helps.

Hi Stephen,

Thanks so much for the help. I’m really grateful your support here and for the automation community in general!

You’ve totally identified the problem: I’ve set my Automator workflow to trash the output rather than trash the original. That’s the core issue.

As we discussed, I am able to:

— Get FineReader OCR Pro to perform OCR on a
— Copy the OCRed file to a new location

(I just can’t figure out how to get it to trash the original.)

I do this through an “Convert to PDF Document” action that comes loaded into Automator.

I’ve attached a Screenshot of the Workflow

I think your Hazel idea is great, but I’m having finding an AppleScript that does the trick (Unfortunately the code that you provided doesn’t do it).

Apparently Finereader OCR Pro is scriptable, but I can’t figure out where to find the scripting dictionary. I’ve never done this before, but I imagine that I could figure it out with Chat GPT, etc.

Can you think of another alternative?

Thanks so much for the help!

Ps. Yeah, it’s an Abbyy product, but mine is listed as FineReader OCR Pro

Wait, I solved the problem! I just combined Automator workflows and Hazel (in the way you recommended), but eliminated the Applescript. Thanks so much!

2 Likes