Keyboard Maestro 9 adds support for OCR (Optical Character Recognition) of both the screen or images.
There is a new OCR Screen and OCR Image action, as well as an OCR condition. The OCR actions uses the Tesseract OCR and you can select the desired language - the first time you use a language, Keyboard Maestro will download the trained data file (they vary in size, but are typically a few megabytes).
There is a default macro in the Clipboard Filters macro group called OCR Image that will OCR the system clipboard. You can use this from the action (gear) menu in the Clipboard History Switcher. This can be a great simple way to copy text that is not selectable (such as text from web page images, or from application interfaces or whatever).
The OCR quality tends to be quite good for screen shots, but more varied for scans or pictures.
You can also combine this with the Find Image on Screen action to find something near the text you want to OCR, and then OCR the area relative to that matched image.
To be clear, the OCR action can OCR any section of the screen, but Keyboard Maestro has no UI for selecting an area on the screen. There is no “Prompt for Area on Screen” action for example, which is what @ccstone’s macro provides.
OK, I'm glad I asked, because that was not clear from your post.
Also, the KM Wiki OCR Screen or Image action is really not clear on this. I had to reread it several time before I found this buried in the text:
When reading from the screen, you can get the image from all screens, or from a specific screen or window or area on the screen.
We need to revise the Wiki to make all of this more clear, and show some example screen shots of doing an OCR from other than the Clipboard.
Actually: there's a shell script that make's us of the partial screenshot function built in OSX. Don't know where I found it but it works like a charm. You get the on-screen-crosshairs to select your screen grab and the text is sent to the clipboard. All credits go to the original poster. Screenshot to OCR:Clipboard.kmmacros (2.2 KB)
I've been using the OCR scan of a rectangle, looking for a bit of text before my macro continues, and I've found that it works maybe 70% of the time. The rest of the time it never recognizes the text it's looking for, even though the circumstances should be identical in all cases.
I assume that you want to enter your TOS PW, right?
You can set it so your username is autofilled.
Just so happens I have a macro that does exactly that.
You may need to replace the image I have for the TOS Login button:
This macro is triggered when TOS launches, and pauses until that button appears.
Then click in the password field and types the PW.
Maybe you have another method of getting your PW, but I decided to use the macOS Keychain. If you use that then you will need to have created a Keychain for it, and use that name in the Action that sets the KM Variable to your password.