Stopping an action at the end of the list

First off, it is rarely a good idea to have a macro execute itself. That Repeat loop will never actually repeat at all, ever. Because when first time around it calls the macro, which never returns because at the end it calls the macro, and it too never returns because it calls the macro and so on.

Eventually you’ll get to 50 macros all waiting on the next one to finish and Keyboard Maestro will throw up its hands in disgust and cancel them all.

Instead you should just do

  • Repeat 99999 times
    • all the actions you already have.

Or if you prefer a While or Until loop, that would be fine too as long as the condition is true (ideally true until you get to the bottom of the list and then false).

On to the next part of the question - how do you tell when to stop. This is often a tricky problem. The easiest way is to just count them in advance yourself and then use a variable repeat loop to do it that many times.

Alternatively, if there is something visual on the screen that tells you there is more to do, then you can use a While or Until loop with the Found Image condition and loop as long as the image is (or is not) on the screen. If the list is longer than the screen, this may not work though unless you’re careful to scroll it on the screen first and then test whether it is on the screen.

There might be other possible conditions, such as whether a menu item is enabled.