That's because in the Editor KM is always "looking" to see if the keys are down. In your macro, as @Airy says, it only checks at the end of the loop -- once every 10 seconds.
Even if you check for a "stop" condition before every skip in your loop you'll still have, on average, a 1 second wait -- and, as you've found, you have to keep the keys pressed until the macro un-pauses and they can be registered.
IMO the best way to do what you want is to have this macro play and skip while a global variable has a certain value plus a second macro to change that global when you want to finish with the current track.
Note that your loop shouldn't be a loop, based on your requirements -- at no time do you want to "after the fourth skip go back and double-click the top song". You might as well write it as a series of actions (although you could, as I think @Airy has, treat it as a 5x loop of a single "Move and Click" action, each loop using different coordinates).
I've left the demo as a "series" because:
- It's easier to how see your original actions have been put into the new "structure"
- Loops-in-loops can be a bit brain-bending
- It shows an obvious repeating flow that can be converted to a loop (consider it homework
)
To test the "Until" action with a Global.kmmacros (30.9 KB)
Stopper.kmmacros (1.6 KB)
"To test..." is the main macro and "Stopper"... stops the skipping. "Stopper"'s hot key is currently ⌥F7, so change to your preference. If you look you'll see the "stop" response has a resolution of 1/10th of a second, which you can change to suit your needs -- remember to set the "number of loops" test so you still get 2 seconds per skip.