Until Loop Question

Hi all,

So, I wrote a macro that should click all instances of a found image. There are two different images that can be found and upon clicking them they disappear. So this action -

does the trick. I just changed the name of the variable to PositionE and the image for the other action. My problem is that when I try to run them one after the other even with a pause between them, the whole macro ends after the first one executes. The action that is able to executes perfectly and I don't have an issue. I've also tried Placing the two actions as a separate macro each and executing that from within the main macro to no avail. Do I lack an understanding of how this Until Loop functions?

I hope I've given enough detail so that someone might recommend a solution! If not, let me know. :smiley:


Hey Logan,

Take a look at this thread, and see if it helps.


That’s actually the original thread that I found my answers in! However, think of it like using two of those while loops to click images on screen minus the highlighting target. When one loop finishes, it won’t continue in the macro to the next loop. It just sort of stops. I don’t know how to fix that. D:

Hey Logan,

You should post the whole macro.

What app are you working in?

These things are often very difficult to troubleshoot without being able to test.


Actually, I'm writing it for a browser game that I play to help automate tedious tasks. It's called Stormthrone by R2Games. Here's a screencap of the macro in full

The first IF statement hasn't fully been fleshed out yet but is still a part of the actions within this task. The macro progresses past that if the popup window isn't detected.

The next part clicks the citadel button. I had to use a more unique button on the interface and offset the click because the citadel button is the same color as a bunch of other things. If the picture of the citadel shows that Gold bubbles or EXP bubbles are ready to harvest, it will click the enter button. Waits 3 seconds for the map to load, and then pops the EXP bubbles.

The macro stops at this point and does not progress any further. I'm unsure as to how I should move past the loop for popping the bubbles.


OK! So, I figured out a way around the problem. If I place each While loop within an IF statement that checks to see if the image is even on the screen, for SOME reason it will allow the While loop to end when it’s finished. I have no idea if I maybe formatted it wrong or what. If someone does have an answer or it’s just a fluke on my part perhaps, feel free to chime in. :slight_smile:

Thanks for listening ccstone! Sometimes, it helps to just type everything out and sit on it for a bit.


Hey Logan,


A couple of tips:

If possible always say what app(s) you're working with when asking for help. As I mentioned it is much easier to troubleshoot problems if you can actually visualize and test them. I have a far better idea of what you're doing after spending just one minute looking at Google Images of Stormthrone.

Never 'restore the cursor position' while testing. You want to make sure the cursor actually got moved to where you wanted it. You can also use a Highlight Location Action to more forcefully demonstrate where the cursor is.

Searching the screen for an image is very processor intensive. Games also tend to be processor intensive. Keep that in mind as it can cause otherwise puzzling pauses or other problems in macros.