Pause until Image Found works, but Move Moouse and Click image fails

I am trying to automate downloading bills and account statements from the web. I often have to click on a particular image. For example, in getting my water bill they have several that say "View Statement". However, above the very first one (which is the one I want) it says "Bills". So, I used the Mac rectangle selection (Cmd+Shift+4) to define a rectangle that included both the "Bills" line and the first "View Statement" button.

In the macro itself II first tell KM to pause until that image is found. I am using "Display" checked on, so I know it has found it. I'm then pausing 1/4 second and then giving the command to click it by picking "relative to the found image's ... (I've tried center, or offsets from the different corners). I've also tried turning Display off in case the green color is fooling it. I've also tried disabling the Pause until step, to no avail. No matter what I do, I get the error message that No unique image was found. This is happening in several macros I'm trying to create (i.e. the image is found but I can't click it as I keep getting that same "No unique image..." error message).

So, since the Pause until is showing (currently true), (and it isn't giving me an error message that it isn't a unique image) and I'm telling KM to click relative to the found image, why do I keep getting this error? How do I solve this? (Or more to my thinking, is this a bug that KM needs to fix?)

Thank you,

Stuart

Bills View Statement

It appears to me that you have different image fuzz factors for the Pause than for the Move Actions.
IAC, you don't need find the same image a second time. When the Pause finds the image, it will set a FoundImage token. Set a KM Variable to this token, and use that in the Move command.

That sounds great. In trying to research it I don't see an actual example of how to do this. I'm using version 8.2.4 but when I tried to set a variable to a token "FoundImage" wasn't listed and if I tried to type it in as %FoundImage% it says Not Available in Editor. (But there is a "FoundImage" when I searched help for it, but I'm still unable to figure out how to use it).

So I'm thinking of using Find Image which I can set to a variable. (Which seems I still need two steps: Pause until the image is found, and then Find Image).

Assuming the token gets set when I do the pause, and/or I'm able to set a variable using Find Image, how to I use that to tell KM where to check?

Thanks for all the help,

Stuart
Trying to insert token FoundImage into Set Variable. This screenshot shows all the "F"s but as you see, FoundImage just isn't listed there:

Error wen trying to type in token FoundImage

Setting (trying to at least) set image location to variable

The insert token dropdown uses descriptive titles, not the token syntax, so the found image token is actually further down:

If you use the Insert Token by Name function, then it will show up as %FoundImage%

In practice, you can use it like this to click in the middle of the image:

2 Likes

The error message says "no unique image found", so it is possible that Keyboard Maestro is finding more than one appropriate image within the fuzz you allow.

Turn on the Display checkbox and see what it is finding.

For a click, the image must be unique (prior to version 9, which appears to be what you are using).

The image looks to be a dull gray image, which is not an ideal thing to search for, since generally the entire screen tends to be full of dull gray blobs of text.

That example was FANTASTIC!!! Thank you so much. I wish they would put something like that up there with the link you sent me. I never saw any reference whatsoever to "The Last Found Image", in all of my researching it. I also just took a chance and start to type in the "LocalImage.MidX" in the "at" box. From the looks of it, particularly with the spinner next to it, I thought it would only take numbers.

This program really can be fantastic but the documentation is weak. Thank goodness for people like you monitoring the forums and giving such fast replies.

BTW, at 20% I'm not having trouble with KM finding the image the first time, so we're all good.

Thanks again,

Stuart

1 Like

Did you review/search the KM Wiki for the Found Image condition, or even just the text "found image"?

From the above link:

After an Action like this is executed, and an image was found, then the %FoundImage% token (v8+) will return the coordinates, size, and fuzz of the image.

This was very near the top of the article.

So, while our documentation can always be improved, I have to disagree that "the documentation is weak". :wink:

There is a Search box in the KM Wiki itself, but I actually find a Google site search to work better. For example:
site:wiki.keyboardmaestro.com found image

So here's a new KM task for you that will be easy and have a high payoff: Write a KM Macro to prompt you for a keyword/lphrase, and then do a Google site search of the KM Wiki site.