Browse the docs

Run Shortcut

Runs a shortcut from the Shortcuts app, optionally passing it input and capturing its text output.

Run the shortcut name

Keyboard Maestro: ExecuteShortcut

Details #

Runs the named shortcut with the shortcuts command-line tool and waits for it to finish. If you give input, it is written to a temporary file and handed to the shortcut as its input: plain text for a string, JSON for anything else. The shortcut's output is read back as plain text and becomes the step's output ({"output": "..."}), with trailing newlines removed. If into is set, the variable gets the text.

Parameters #

ParameterTypeRequiredValuesWhat it does
nametextYesRequired. The shortcut's name exactly as it appears in the Shortcuts app.
inputany valueText or data to give the shortcut. Leave it out, or leave it empty, to run with no input.
intotextThe variable that receives the shortcut's text output.
sampleany valueWhat into holds during a dry run.

Every step also accepts label, onFailure, timeout and dryRunSafe.

Examples #

Run a shortcut and show what it returns
Do
  1. Run shortcut “Get Weather Summary”
  2. Show “{{summary}}” for 4 s
Open in Switchboard to try it

Gotchas #

  • Dry run. The shortcut does not run; into gets sample or an empty string.

  • Timeout. The step is cancelled after 10 s unless you set timeout on the step. Shortcuts that show dialogs or wait on the network often need more.

  • A name that matches no shortcut fails the step with shortcut "name" failed and the tool's message.

  • Output is collected as plain text. A shortcut that returns a file or an image gives you its text form, or nothing.

  • A shortcut that asks you a question waits for you in its own window.

See also #

Run shell script, Run AppleScript