KM's OCR Actions vs Monterey's Live Text OCR... And The Winner Is

Good point about the Safari.. haven't thought about it.
I'm not that huge expert, this is why I just import the macros and edit only the path... In your case I see you used different variable, which you set in the first step:
Set Variable - LOCAL__Screen
This needs to be the same variable in the Shell Script execution, there you used "Var"...
i.e. in the Shell script - change the save to variable to be LOCAL__Screen, then in the last step it will be %Variable%LOCAL__Screen%

Then it should work... Or just really copy/paste my setup :slight_smile:

Yeah i had it your way origionally and didnt work. Tried the LOCAL way and didnt work either. Sucks but thanks for help

Would love if you could share your file some reason duplicating manually is not working

Thank you sir

As much as I prefer KM for everything, I ended up strictly using a Shortcuts for this. I mapped it to cmd-shift-2 and it works well, though it can be a bit slow to launch sometimes (it might take 1-3 seconds). I actually forgot I did this as a Shortcut and spent a lot of time trying to find my KM macro for this before figuring out it wasn't a KM macro.

I wonder if "combining" this with a KM macro will speed it up. I'll have to give it a try.

2 Likes

Quite good idea as well... I don't know how you got the first line with Receive Any input from Quick actions... but I just skipped it...
I just used KM to trigger shell script to run the shortcut and it does the same as the other macro, with the only difference that now there's a popup saying what's the output of the macro, which is weird, but for me a good result too..
About 1-3 seconds delay.. using KM to trigger the Shortcut - I see no delay at all, it's just instantaneous. Thanks for sharing your solution!

if you click on the shortcut and then the "settings" button up top and select "use as quick action" the "receive any..." appears. Thats also how you can assign a keyboard shortcut for it. This way seems to work for me vs the other above only difference is you cant select the portion of the screen

1 Like

under the interactive screenshot click on 'show more' and selection should be Custom. Thanks for the Quick Actions hint.
I can't get the shortcut to run consistently with a keyboard shortcut. As @edjusted mentioned - there's delay and for me depending in which app I'm trying it, the delay is indeed between 1 to 3 seconds.
All in all, I'm happy that I've learned something new, but I'll stick with KM + Shortcut. This way it works flawlessly

ah. im running on new mbp and seemless for me

Wow, that works even better. It seems convoluted but it works.

I created a KM macro that just runs the Shortcut and mapped it to a hotkey:

Screen Shot 2021-12-09 at 12.51.29 PM

On the Shortcut itself, I turned off the "Add keyboard shortcut".

No more delay!

1 Like

I'm trying out the method that saves a screenshot and then runs Monterey's OCR and although I wouldn't say it's noticeably quicker, it is a lot more accurate. Fantastic!

1 Like

Yes, I’ve found - it can recognise just about any text, even Gothic fonts and some handwritten text. And it is able to ignore lots of other non-text objects in whatever image you are using.

I'm actually finding it quite a bit slower than KM's own OCR. Is that your experience too? Probably to do with having to write a file first. Shame there isn't a way to directly OCR a defined area within Shortcuts...

It takes between 1 to 3 seconds I find. At a guess I would say it's the processing of the image to get the text rather than writing the temp file that takes time.

BTW since Keyboard Maestro 10.1 (I think) you can use Keyboard Maestro's native Execute Shortcut Action to do this. You probably already know this. Instead of this:

You can do something like this:

2 Likes

I have this as well and find it invaluable. (Someone on Zoom is showing a Google doc and I can grab the URL from the image)

What really seals the deal for me Neil is using your long-press trick. I've got a function key mapped to "Copy" and if I hold it down a bit it becomes "Select a range and copy the OCR of what you find" :+1:

3 Likes

I've noticed that, although what it does capture tends to be more accurate, the Monterey version doesn't like short numbers. Presumably it doesn't recognise them as characters because there's an insufficient pattern.

An OCR of this...

CleanShot 2022-06-26 at 14.32.17

...returns this.
20
39
49
303
73
488
83
65
359
104
15
355

Notice that 7, 15, 8 and 1 are all missing.

There's one more thing you can do to speed it up a tiny bit.

Instead of writing the screen capture to a file and running the shortcuts on it, write the screen capture to the clipboard, then run the shortcuts on that.

My shortcuts is just 3 lines long:
Get clipboard
Extract text from Clipboard
Copy Text from Image to clipboard

1 Like

Thanks. That's what I'm doing now actually. I can't trust it for everything though, as it often doesn't recognise single or double digit numbers.

I run into the same problem with capital "I" if it's a skinny non-serif font, even when it's in the middle of a sentence.

I've found that sometimes, it might help to capture some "noise"...like if the numbers are surrounded by a box or something like that, capturing the box or even part of the box seems to help the OCR understand that single characters (especially "ones" and "I's") aren't just debris. YMMV of course.

2 Likes

I've just seen the below by @gglick - it works without having to make a temporary file first and seems to be faster.

Yeah, that's exactly what I ended up doing!