I would like to run some notification like this asynchronously. I know several actions have that option in the cog wheel but not all.
Other things would be actions like enabling and disabling Macro groups in a macro. I'd love to group them all and just have all the actions in that group be asynchronous but maybe there is a better way. I don't need the next action to wait for them to finish so I am trying to get things to happen side by side if possible but yet keep them all in the same macro group without making them each a submacro to have them run asynchronously.
Have you got some other examples, given that this one is trivially done with an async AppleScript? Because I'm struggling to see a use case where you could gather together enough "independent" actions to make the extra overhead of a separate process(es) worthwhile, yet it's not worth a sub-macro.
I think the best solution for me is for a new action in KM called "Group - Asynchronous" which would run each of the actions that it encloses asynchronously, even if there's only one action contained in it. Even better, the cogwheel of this action could have an optional flag that prevents subsequent execution from happening until all internal actions have completed, or just create a different group action called "Group - Parallel" which runs its internal actions asynchronously but waits for them to finish before moving to the next action. I would use this a lot.
Running those sorts of actions asynchronously would not make any difference to performance.
In any event, if you are using Keyboard Maestro as some sort of performance scripting system, then you are going to be disappointed - Keyboard Maestro is designed to be fast, sure, but it's not designed to be a fast scripting system in the sense of executing large numbers of actions.
The biggest thing is to run Dan's notifications but have a 2-second timer on it without having to wait for the other actions to run. I wouldn't quite know how to AppleScript all those parameters, but I have been putting them as sub macros and breaking each of the notifications out, which seems a bit like a messy house, but I very much love the notifications that he made with all the parameters and want to keep using those since I can adjust position, color and the many other great features of it.
I'm sure I could figure out how to disable and enable macro groups easy enough with AppleScript that one shouldn't be too difficult. I guess you would just tell it somehow to run asynchronously in the script because I don't see that option in the cogwheel for AppleScript.
OK, that's good to know. I have some actions that do a bunch of key commands that I was just hoping to have certain groups disabled by the time all the key commands were run, but if it wouldn't make much of a difference, that's a route not worth pursuing. Thanks for the information. It would be helpful for the time Notifications though and I'll just stick with making some macros for that since there's no option to run asynchronously in the action.
But that kind of dependence makes asynchrony -- in this case, parallelisation -- more difficult. Because you are going have to make sure that certain groups are disabled by the parallel process before the "main" process continues. Oh, and you'll have to do your own error handling as well...
Not insurmountable problems, there's many macros been posted here that do similar, but problems that are avoided by sticking to sequential processing.
It's at the bottom of the "results" pop-up. Which highlights another issue -- async processes run "outside" your macro, so watch out for those local/instance variables and remember to use a global to pass data.
IIRC, Dan's macro is a parameterised sub-routine so is already separated from your macro. And it has an async option. So it sounds like what you are actually lacking is the ability to call his sub and then delay its start-up for a couple of seconds. You can achieve that going the "async AppleScript runs the actions' XML" route but there's some work getting all the local variables in...
Weird I even have it saved to be async set to yes. It forgot that but it seemed like it was running after other things. I will have to play with it more. Thank you.
Thank you, I will see what I can figure out tomorrow and play with that more. Thanks you both for the info.