Get Area Coordinates to Set KM OCR Action Macro (v9.0.4)


Use Case

  • KM9 introduced a powerful new feature: OCR Screen action
  • Unfortunately, if you want to OCR a specific Area on the screen, you have to enter the coordinates manually. There is no "Get" button like with Found Image.
  • This Macro lets you click on the screen to pick the Left, Top and Right, Bottom points of an Area, and then use that data to actually enter the coordinates in a OCR Action.
  • This Macro was inspired by @Peter_Sanders macro.

MACRO:   Get Area Coordinates to Set KM OCR Action

Version: 1.0  ⇢  2019-12-17
Requires: KM 9.0.2+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Get Area Coordinates to Set KM OCR Action.kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered. It was also uploaded with a HotKey Trigger of CTRL-F1.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Get Area Coordinates to Set KM OCR Action

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.

  2. Add an OCR Action to your Macro, and make sure it is visible in the KM Editor Window.

  3. Trigger this macro.

    1. Position Mouse to TOP,LEFT of Area to OCR
      CLICK Left Mouse Button to Record Coordinates

    2. THEN Move to BOTTOM,RIGHT of Area to OCR
      CLICK Left Mouse Button to Record Coordinates

    3. Review Displayed Rectangle
      Press "YES" when it is acceptable

    4. Click in the FIRST Coordinate Field of the OCR Action

    Area Coordinates with then be typed into each field.
    Existing data will be overwritten.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
    • Most likely will be a MG with GLOBAL access.
  3. ENABLE this Macro, and the Macro Group it is in.
    .

REQUIRES:

  1. KM 9.0+
  2. macOS 10.11.6 (El Capitan)+

TAGS: @OCR @Area @UI

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
    • Ask first
    • Turn on the KM Debugger from the KM Status Menu, and step through the macro, making sure you understand what it is doing with each Action.

3 Likes

Surprised I'm the first to comment as this has been incredibly useful for me. Clever stuff!

Apologies if I've missed an existing tool for this, but... I was wondering if a second version of your macro could be adapted to include an option to return simple coordinates relative to start and end points without all the confirmation dialogues? I'm constantly using the snapshot tool to view and memorise coordinates relative to a starting point (found image for example). It would be very handy to hit a shortcut, click my start (found image) and end (position to click relative to found image) point and then click the coordinates field and watch the numbers get pasted in.

As an aside, is there a way to skip the dialogues in your existing macro? Now that I've used it a few times and know how it works, I'd like to be able to hit the shortcut, click the two points and then click the first coordinate field and that's that.

Again, thanks for making this. You've saved me a lot of time over the past couple of weeks!

Hey there, as you probably heard by now but JMichaelTX passed away recently.

As to your question, you can easily modify the macro to disable the confirmation dialogs, that way all you have to do is hit the hotkey, click the two areas, and then click in the first coordinate box. That's how I modified my version of it. If you're unsure how to do this, let me know and I can share my version which has those adjustments made.

2 Likes

Oh goodness. I had no idea as I haven't been on here for a few weeks. Very sorry to hear that. I just saw Peter's post now.

Thanks for the advice. I tried disabling the actions and it works. :pray:t3:

2 Likes