Prevent last repeat of "Execute Actions Until Conditions Met"


I have recently been using the "Execute Actions Until Conditions Met" action but it has a drawback.

Once the condition is met, the macro will obviously finish what inside it but I need the macro to NOT repeat what is inside the "Execute Actions Until Conditions Met" and instead skip over to the following action.

For example, let's say I need to type "Hello Kitty" exactly 10 times (and no more) and then have the macro continue to any actions that follow.

Right now I have a User Prompt with 3 buttons as follows: [Type "Hello Kitty"], [Cancel] and [Continue].

If I click [Type "Hello Kitty"], it will obviously type it.
If I click [Cancel], it cancels the macro.
If I click [Continue], it will type "Hello Kitty" one more time before it's done with this sequence.

So if I need "Hello Kitty" 10 times, I have to click that button 9 times.

To keep this post succinct, I don't want to explain why I can't simply click it 9 times. In the job I am trying to complete it's not easy to know if 9 times will do.

I'm sure there's a way to do what I need but I can't think of how. Any help is appreciated. Below is the macro I'm testing with.

TEST.kmmacros (3.6 KB)


If you always want at least one execution, you can do this:

  • Until
    • Insert Text
    • Prompt
  • Until button is Continue

If you want zero or more, then you need to rework your macro:

  • While true (calculation 1)
    • Prompt
    • If button is continue
      • Break From Loop
    • Insert Text

This structure:

  • While true
    • Do stuff
    • Break From Loop If
    • Do stuff

Is basically the generic form of a loop.


Works beautifully. Thanks!