Moving OCR capture area using space button

Just wondering, if there's a solution to move the area of the OCR capture area around the screen once you start capturing.

Prior to KM v10 i used the system capture/screenshot tool using the space button to move where i want to capture the text, i was wondering if there's a solution that i can implement natively in KM.

Keyboard Maestro 11.0.1 on macOS 14.1.1

Macro Image

TIA

Sure it's possible. I had to do it when I wrote the following macro. It's a complicated macro, but you can get ideas from reading it. Or, if you indicate what you want to do with your area, I could possibly write some code for you.

In your example, you saved the coordinates of the "OCR rectangle" in a variable called "Result". At any time, either before or after your OCR action, you can change the contents of the Result variable. I use that approach extensively in my macro above.

What is it that you want to do to the "Result" variable? Maybe move it (the rectangle) to the right by ten pixels? Then you could simply increase the x value of Result by 10. The possibilities are endless, but you have to use arithmetic and KM actions to accomplish it. A simple example would be:

Of course, you also should be cautious that your new coordinates fall within the boundaries of the screen. My macro above is very careful about doing that correctly.

1 Like

Just use the screencapture tool in a shell script:

Draw the rectangle with the mouse, and to move the rectangle hold down the spacebar (before releasing the mouse) and drag the rectangle around.

The c switch means 'save to the clipboard', the i is 'interactive'. (Enter man screencapture in the Terminal to get a list of all switches.)

i'll check it out. Thanks

I Been using that, i was wondering how is it different from the New Apple Text Recognition on KM V11?

I'm a big fan of Apple's new OCR. It cuts down errors by more than 90%, and is about 6 times faster (depends on which CPU you use.) It can read things that the old OCR cannot possibly read, like hand printed text. Sometimes even handwritten text.