What is the appleScript syntax to run 2 KBM macros sequentially?

For example, I want to run the following 2 macros sequentially:

-- ignoring application responses
tell application "Keyboard Maestro Engine"
do script "16E2A415-81DF-484A-9735-279BDB83FCC0"
-- or: do script "Scrivener Lock Editor ⌃⌥ L for Luna display"
-- or: do script "16E2A415-81DF-484A-9735-279BDB83FCC0" with parameter "Whatever"
end tell
-- end ignoring


-- ignoring application responses
tell application "Keyboard Maestro Engine"
do script "D1D99285-D4A1-4699-9B6B-DF1086843BC1"
-- or: do script "Scrivener Cursor on Main Screen Luna Display"
-- or: do script "D1D99285-D4A1-4699-9B6B-DF1086843BC1" with parameter "Whatever"
end tell
-- end ignoring


thanks in advance for your time and help

Easier than you might think. All you need is a single tell block with both do script lines inside it:

tell application "Keyboard Maestro Engine"
do script "16E2A415-81DF-484A-9735-279BDB83FCC0"
do script "D1D99285-D4A1-4699-9B6B-DF1086843BC1"
end tell
3 Likes

@gglick has given you the answer. For future reference, here's the logic.

With any AppleScript, you can include as many commands within a tell block, like tell application "Keyboard Maestro Engine", as you want. They always execute sequentially.

Questions?

3 Likes

@gglick @JMichaelTX
thank you both for your help

1 Like

thank you for your clarification

In the vein of your response, if I run 2 applications sequentially, would the script be

tell application "Keyboard Maestro Engine"
do script "16E2A415-81DF-484A-9735-279BDB83FCC0"
do script "D1D99285-D4A1-4699-9B6B-DF1086843BC1"
end tell

Tell application "Mail"
activate
end tell


If it's not asking too much, is there a simple way to convert the following to an apple script , which I would append to all scripts using the iPad hard palette ?

Unfortunately AppleScript does NOT provide us with a good way to move the mouse pointer. So, in this case, I would just create a KM Macro with your Move and Click Action, and call that Macro from AppleScript, like you do the other Macros.

1 Like

very useful. thank you

by that I can infer that the hope of one day KBM providing users with the ability to extract a macro's complete appleScript (as opposed to run macro number xyz) is pure fantasy.

I'm not sure what you mean by that.

It is very easy to click on the Macro trigger "or by script", and get the actual AppleScript:

image
image

Is there something else you're looking for?

1 Like

thank you
yes, I do that all the time.
I meant the actual appleScript as opposed to do script macronumber.

@ronald ,

Sadly, @JMichaelTx is no longer available to continue the conversation.

Did you ever get an answer to your question? I don't understand what you mean by "the actual AppleScript". You said something about

which suggests to me, ICBW, that you might be thinking that the KM macros are actually written in AppleScript and you would like to see that, instead of calling the KM script by name or number, e.g.:

do script "Scrivener Cursor on Main Screen Luna Display"

or, alternately,

do script "16E2A415-81DF-484A-9735-279BDB83FCC0"

Like I said, I'm really not sure what you were asking for here. Did you ever get it resolved?

Since KM allows you to have more than one macro with the same name, some people prefer to call KM macros by numerical ID, so there is no ambiguity, but if your name is unique, then it's just a preference. That's why the sample code in the KM macro interface shows alternatives.