Is This (Really?) the Best Way to Wait-And-Click-Found-Image?

I've been reading around for half an hour and trying to determine how to solve a problem:

How do I click the image that I just paused-and-found with "Pause Until"?

The main issue is that I have always just tried to copy the exact image and parameters in the Click action as I have in the Pause Until action. This is fragile though as it's just about impossible to copy the exact "fuzziness" into the second action. It seems there should be a way to just say "ok now click it!"

I've found info on FoundImage though there is some missing info. E.g. the Wiki page says "If you set a Variable (say ImageLoc) to this token, then you may reference individual properties." That seems incomplete at best - how does one set such a variable? If it's set "to text" then the new variable is, like the old one, just text. There must be some other way to set it. For now I'm using a regexp to parse between the commas (left,top,width,height) but that feels pretty clunky.

It's surprising that FoundImage wouldn't just let me reference subfields immediately but maybe someone thinks plain text is more useful. Ok.

  1. How can I eliminate the regex and access fields as the Wiki says is possible?
  2. I use this pattern constantly over the years with KM (Wait for image to appear, then click it) in many applications. I'd be surprised if others don't. It's more robust than "wait .5 seconds then click image" because of occasional app slowdowns. Although the version above is deterministic, unlike copying the image parameters per my first example, it's still long and clunky. Can this be made shorter somehow? I'm not sure which I prefer - the nondeterministic version or this clunky version with three steps including regex.

Ideally, under "move or click mouse" there would just be an option for "midpoint [or whatever point] of last found image" which would be super simple. I would use that dozens of times in my macros.

I believe the Wiki should be updated too to indicate how to set a variable and access those subfields of FoundImage (left, top etc.) because I at least (programmer and experienced user) don't know how after reading it twice - I only got text out of it. There are many ways to "set a variable" so that at least should be specified. I'd update if I knew the answer.

Don't want to seem like I'm complaining too much - KM is great and totally essential for me. Thanks if you can help!

Ok, I believe I found the minimal version in the forums. This does have an extra step of setting a variable - not sure why that would be necessary but it's usable. Here's the link with the exact syntax.

Created a helper macro to abstract the slight weirdness here - this definitely is sufficient and plenty convenient. Just running this right after "Pause until found image" clicks the center of the image.

3 Likes

Hey @Freewalker,

Looks like you figured it out. Well done.  :sunglasses:

-Chris