Now that I participate in more online meetings and webinars (thanks to COVID), I regularly find myself using Keyboard Maestro’s OCR text capture action that copies text straight to the clipboard and automatically pastes it where I want.
OCR (Optical Character Recognition), extracts text from a screenshot, and after the action runs, it pastes the extracted text to a document or text space. The technology has been around for a while, and it’s great to see that it’s a Keyboard Maestro action.
In this article, I show you how to set up a OCR macro action, and then I explain how I map the action to a BetterTouchTool action so that I don’t have to manually press the keyboard shortcuts. (By the way, here’s another article about taking screenshots without manually pressing the hotkeys.)
The KM OCR Action
The OCR macro is easy to set up. Keyboard Maestro 9.0 and higher has the action pre-installed. Here’s how I set up my macro, and I explain why I use five particular actions. You can of course set up your macro to fit your particular needs.
Note: these instructions assume you are familiar with how to use Keyboard Maestro. Basically this macro triggers a screenshot and places the capture on the system clipboard, and in the last step, the OCR Trigger Clipboard action pastes the text from the clipboard into a text document or area. If you’re not familiar with Keyboard Maestro, here’s an introductory article.
- I created a keyboard shortcut trigger in order to map it to a BetterTouchTool screen edge trigger. If you’re a Keyboard Maestro user, you know that actions can be triggered in other ways.
- This Keyboard action triggers the default Control+Shift+Command+4 Mac shortcut that places screenshot directly to the system clipboard.
- The Display Text Temporally action reminds me to place the cursor where I want the copied text placed. I won’t always need need this reminder, but it’s not intrusive, so I’ll leave it.
- This Pause action gives me time place the cursor where I want the text pasted.
- In this final step, the OCR Trigger Clipboard action extracts text from the copied image in the system clipboard and pastes it in a text area or document where I need it.
Note also that the OCR action has other options for displaying and using the results of a text capture.
BetterTouchTool Edge Trigger
I could use the assigned Keyboard Maestro shortcut to trigger the micro, but in stead I have the shortcut mapped to a BetterTouchTool screen edge trigger, which only fires when the Zoom application is the frontmost application.
Assign Edge Trigger
- BetterTouchTool includes a section for other types of triggers, which include what are called screen edge triggers.
- I assigned the Move Mouse to Top Edge Screen to trigger the assigned Keyboard Maestro shortcut. This trigger is application-specific, which means it only fires in the Zoom app. I also have similar OCR macro that I can use in any application. I use the BTT trigger so that I don’t have to move my fingers back to the keyboard in order to press the keyboard shortcut.
Assigned Shortcut and Name
- I simply mapped the Keyboard Maestro shortcut to the BTT action. Probably at some point, BTT will have its own OCR action installed.
- I try to give all my actions a name to remind me of what they’re used for.
OCR Capture Image Demo
The following quick video shows the KM OCR action, though you can’t see how I pointed the cursor to the edge of the screen. Notice that text in the screenshot capture is very clear and not layered over a photo or other image distractions. OCR only works best with clearly contrasted text. You will need to experiment with different shots to see how OCR works best.
Best Text for OCR Capture
In order for OCR to extract text effectively, the text needs to be clearly contrasted with the background.
Not Good for Capture
The text in this screenshot does not capture well because there’s way too much distraction in the background of the text. Plus, the text is slanted, which also creates problems for text capture. When I tried to OCR the image, the results came out like this:
a ee ~ Fe
a uP a os =~
: egeaneetegee e
Rene ey ey
F \4 /] Vy \ O
Good Text Image for OCR
GET 60% OFF OF SUPERTAB 3.0
WHEN YOU LINK HERE
As I was writing this article, I learned about a third-party OCR application, called TextSniper, that does pretty much what the Keyboard Maestro action does, though I don’t think it has some of the options the KM action provides.
You really don’t need this application if you have Keyboard Maestro, but if you just want a dedicated application for OCR capturing you might want to check it out.
Let me know what you think about this macro and BTT setup. Is OCR capturing something you use in the work you do?
SUBSCRIBE AND GET ACCESS TO THE MAC AUTOMATION TIPS RESOURCE LIBRARY
Over a dozen guides for how to use powerful automation applications, including Hazel, PopClip, Siri, Alfred, and more.
Hi Bakari Chavanu,
Can you share this km file (KM OCR ACTION)?
I’m learning KM but is dificult for me.
Hi Rafael, I can look into sharing the macro, but are you finding the OCR action in KM?
HI, I’l try. thanks.