Does KM support synchronous operations between macros?

I've been searching for an answer to this question and my searches seem to always return Macro Sync which is syncing of macros between Mac's.

But what I really wanted to know is if there is any way to set a macro that is called within another macro OR a subroutine macro so it is synchronous; so that the next subsequent action isn't executed until the completed execution of the embedded macro or subroutine macro.

When I began using KM this year, I was introduced to the concept of "Pausing" by examples given to me to accomplish certain tasks. Is this the only way to prevent the execution of another task before the prior has completed?

The default for Keyboard Maestro is what you are describing. Each step, including the running of another Macro or a Subroutine is completed before moving on to the next step. So, if you have a Subroutine that pauses for 20 secs, the main calling Macro will pause for 20 seconds before moving on to the next step.

If you want the opposite behaviour when calling another Macro, you can use the gear menu in the calling Action and set it to Asynchronously. Then the sub Macro will be fired and run but the main Macro won't wait for it to complete whatever it is doing before moving on.

Subroutines don't have the option to run Asynchronously. They always complete all their steps before returning to the main Macro.

EDIT - but "completing all steps" is not necessarily the same as the System completing all the steps... It's possible the Subroutine might need a pause at the end to allow the System to catch up with whatever the Subroutine is doing.

I see... I wasn't aware of that with subroutines the behavior changed in that way and maybe that's why I am just noting the asynchronous issue.

I was just introduced to the concept of subroutines and I have one that is being called within a macro. I have a Display window executing after the subroutine and the display pops before the subroutine returns a value.

So in this instance I suppose a "Pause" would be the viable option?

That shouldn't happen. The Subroutine should complete and return its value to the main Macro before the main Macro does the next step. Could you upload the Submacro?

Read Audio LUFS Results.kmmacros (19 KB)

Try replacing the last Action in the Subroutine with this one:
Return from Subroutine.kmactions (440 Bytes)

And the Action in your calling Macro would look like this:

So @Zabobon - this may be a by product of my blundering oversight b/c I'm now noticing that I don't have a "Return from a subroutine" action and the window could be popping after the subroutine execution as you pointed out but it has no value b/c the subroutine is not returning a value.

So it only "looks like" the window is getting executed before the subroutine completes when that probably is not the case.

I'll check this now.

It is not intuitive the way this works. To return a value from the Subroutine you have to not only check the box at the top but also add a Return Action at the end.

Thanks for the feedback. Per my previous reply:

Anyway, I did run some tests and the issue was as I'd suspected and as you'd pointed out; there was no return value set on the subroutine. So it appeared the subroutine hadn't completed because there was no value in debugging the output of the returned value from the subroutine. Totally my bad.

Per the other suggestion. My calling routine was already setup correctly so no issues there.

But upon downloading and attempting to open your macro I get this:

Any ideas?

Nevermind, I see that it added it to my existing macro. The message isn't easily understood.
Thanks for your help!

@Zabobon I believe another overlook on my part regarding synchronous operations is the realization that launching an external terminal in KM runs outside the synchronous operations of other KM action tasks. Just a general observation noted.