How to add loop to macro to close all windows macro

The question concerns the create booklet app, but the actual app is irrelevant. I am trying to understand how to create a loop mechanism.
I often have up to 10 windows open in create booklet, and just close them all at once without saving
To close the windows, I press file → close→ press the button discard → press the button revert→ go to next open window.

There are 2 issues:

  • how do I create a loop so that the macro continues until no more windows are open. I had the idea of continue until File→ close in not enabled, but it's the looping part I don't understand. I suspect that I could use the repeat action but not sure how.
  • sometimes the buttons discard→ revert appear in sequence; other times only the button revert appears and has to be pressed. How can I manage this in the macro ? Should I simply put a timeout of 3 seconds for the 1st button discard ?

I would prefer a KM solution rather than AppleScript to help me better master KM.

thank you very much

Close all Windows - no not save.kmmacros (4.4 KB)

Screenshot (click to expand/collapse)

This works for me in Pages. If a pop-up appears, it will press Delete. I think that's what you want. I placed a 5 second timeout value on the Press Button action, and you probably will need to do the same. (Also, turn off "Notify on Failure" and "Failure aborts Macro.")


I'm afraid I don't know what that means because I don't have your app. You said the app is irrelevant, but that description seems to apply to your app, not to Pages.


works perfectly. thanks very much