OCR area relative to current mouse position

Hi everyone,

This is probably something most of you could solve before your first coffee, but I couldn’t find a solution within the forum.

I would like to OCR a specific area based on my current mouse position, save the numeric content to a variable, and use it to create an if/else scenario (depending on the value).

Thanks, and have a great day!

Simon

  • The OCR Screen action has an "Area" option
  • The "Area" option's fields are numeric fields -- it isn't obvious, by default they look like number fields with spinners, but if you add text they morph into "full" calculation fields
  • Calculation fields can include Functions as well as maths
  • The MOUSEX() and MOUSEY() functions return the pointer's current horizontal and vertical coordinates

Putting all that together and you could, for example, OCR a 100x100 square centred on the pointer and saving the text recognised to the variable Local_result with:

image

Hopefully that's enough to get your macro started -- see how you do with the rest. If you get stuck then post what you've got so far (see How to Post/Upload your Macros and Scripts) so people can help more easily.

2 Likes

My response here is not an answer to your question, but at one time I created a macro that performed OCR on any clipboard content if it contained an image, and then read the OCR'd text that it found in the image, and then spoke that text aloud. I haven't turned the macro off yet, so every time I take a screenshot, any text in the screenshot is read aloud to me. It acts like a confirmation of the image that I took.

1 Like

Thanks a lot, Nige!