Find image within certain area of window?

Is it possible to find an image with in a certain area of the front window? There are other like images in the window and the number of like images always varies . But there is one single image that is always with in a certain area of the front window. I would like to determine if it is there with in that area and then click the image, if it is present. If not it would do nothing


Yes, it is possible.

To click an image in a certain area, use KM action, "Move and Click Found Image".

Instead of the gray triangle in the center of my example below, click and paste in the image you are looking for.

Specify the "area" variable at lower left of the action box.

Here's an example:

Arg, I feel like an idiot.
I had looked at the co-ordinates that can be set and thought that it was always from the top left corner that they would work.
I now understand.
My oversight,
Thank you for getting me to look at it again

Don’t feel like an idiot. KM has so many features, it’s easy to overlook them. We’ve all experienced it, even after using KM for ages.

So it’s good you posted the question, because if you had the question, others probably will also!

You can also use the “in area” option for the search, and then use the WINDOW function to calculate the position to search, eg:

WINDOW(0,Left), WINDOW(0,Top), WINDOW(0,Width)* 50%, WINDOW(0,Height) * 50%

Which would search in the front window, in the top left quarter.


Thank you Peter, - but how would I implement the 'window function' in this macro?


Exactly as I described, WINDOW(0,Left) in the first area field, WINDOW(0,Top) in the second, etc.

Area coordinates are relative to the top left corner of the main desktop, as are the results of the WINDOW function for coordinates.

I get the co-oridinates of a window - how to enter them.
I don’t see in the example of the screenshot I posted, where or how I would put that function into that macro. ?
Can you tell me how to implement the window co-ordinates into my existing macro.
Sorry if I’m being thick. -

1 Like

arg, got it, didn’t know you could enter the function parameters directly into the
’area’ designation fields. !! YIKES =)
thank you

See the Text Fields documentation in the Wiki.

Most numeric fields can expand to accept a formula.

1 Like

This is one of my few pet peeves with KM. I wish this were more obvious.

I’m open to suggestions as to how…

It’s made obvious by the fact that they all behave the same way, so you only have to learn it once. But I can’t think of any good way to keep it simple for the simple cases and yet make it obvious it is expandable.

Hmmm. LOL. It’s easy to tell someone something generic - a lot harder to come up with a solution.

Nothing comes to mind. Maybe other people have an idea. Dang, I suck. :slight_smile:

1 Like

I also discovered that relatively late. But now I think it’s fine as it is :sunglasses:

4 posts were split to a new topic: How Do I Know What Can Be used in Action Fields?


This very common problem could be solved with a “Wizard”.
Unfortunately, that would be a lot of work for the developer.
So I’m only mentioning it, not requesting it.

Example dialogue:

"This action offers 'area' of entire screen or just a selected area.  
 For entire screen, click continue.  To select area, click area."

"Select area offers fixed coordinates, or a function, or formula.  
 Commonly used functions here are cursor position or found image position. 
 A common formula is ... 
 Select your choice..."

A Wizard like that would eliminate the need for 80% of beginner posts on this forum.
And, perhaps, 80% of private emails to KM support.
(But would not eliminate the mentally lazy, of course.)

The nice thing about a Wizard is it can be built up gradually, one field at a time, with the most problematic fields first.
If the Wizard were driven by a decision table, that table might be a page in the KM Wiki – with limited access same as the Wiki has now.

Option button to toggle Wizard on/off in header bar of KM editor.
Or 1-2-3 levels: Beginner / Intermediate / Advanced.

I’ve been experimenting recently with the action, “Prompt for User Input”.
Very powerful, very flexible; perfect tool for creating a Wizard.

But would be a tremendous amount of work.
I suspect that answering beginner posts and emails, one at a time, is probably a more effective use of time.

Um, how about just using the Keyboard Maestro Editor’s menu item “Window->Mouse Display”?

Works fine for this purpose.