Forcing actions to execute sequentially

I could have sworn I saw something here recently about forcing actions in a macro to execute sequentially, i.e. each action waits for the previous one to complete before continuing, rather than execution of different actions overlapping. Was I imagining that?

might be the "failure aborts macro" checkbox? (inside the gear)

Without thinking too much, isn’t this the default behavior? Normally, if an action fails, the macro is aborted, which implies that any action waits for the the previous one to be executed successfully.

Also the fact that you can leverage the previous action’s result with the %ActionResult% token points in that direction (The token will not work with all actions though.)

Yes, this is a point, too. Somehow I thought this was the default setting, but probably I was misleaded by only checking some of my macros, where I had manually changed that setting.

That is, in general, the behavior of a KM Macro, with the exception of system events that some Actions send, like:

  • Copy
  • Paste
  • Type a Keystroke
  • Some Select a Menu
  • etc

So, the technique I use is to put a Pause after any Action that I know (or suspect) might not wait for the application or system to complete the system event. To that end, I use the following:

  • Create a global KM variable "DND__PauseStd", and set to 0.1 sec
    • You can set this in the KM Prefs Variables Panel, or via an Action in a standalone macro
  • Then, at the top of every Macro, I insert:
    image
  • Then, wherever I think I might need a pause, I insert:
    image
    • This can be over-ridden for specific cases that might require longer pause

Both of these Actions are stored in my MACRO: [KMFAM] Favorite Actions and Macros for quick and easy use.

2 Likes