Click Found Image based on which image it finds [SOLVED]

I set the IF THEN action to find at least 1 of 3 images before it executes the next action.
How can I set it so it clicks whatever image it finds?
Let's say it finds image 2 on the screen. Now I want it to know that that's the image it needs to click, instead of adding 3 IF THEN actions for all 3 images individually.

1 Like

This is where the Token %FoundImage% can be used. It stores data about the image that was just found. This data can then be used to move the mouse, set an area or whatever else your Macro is doing.

https://wiki.keyboardmaestro.com/token/FoundImage

But there is probably a much simpler way to achieve what you are doing. If you just want to click on one of three possible images on screen, you can set up three Click at Found Image Actions one after the other (each one for the different image) and using the gear setting in each, set each one not to abort the Macro on failure and not to notify on failure if the image isn't found.

1 Like

That's a good thing that I didn't know. Going to bookmark that.
Now my question is, if you have that info about the image that KM found, how can I make it click it? When I use Click at Found Image or Move or Click Mouse, I don't see any option to do it...

Your second option seems like a good workaround. I will use it for now until I understand how to use the data from the token to make the mouse click it. If you know how to do it, can you also share how to make it click the center of that area? I'm assuming that the left and top values are related to the top left corner of the found image?

Click One of Multiple Found Images.kmactions (2.6 KB)

Action Screenshot

Pause Until One of Multiple Images Found.kmactions (3.2 KB)

Action Screenshot

2 Likes