User Tools

Site Tools


manual:URL_Schemes

Table of Contents

**This is an old revision of the document!**

Command Line Tool

Keyboard Maestro includes a command line tool to let you execute macros from the shell command line. The tool is named keyboardmeastro and is located within the Keyboard Maestro.app application. Assuming the application is installed in the Applications folder, the command line tool will reside at:

/Applications/Keyboard Maestro.app/Contents/MacOS/keyboardmeastro

You may want to create a shell alias for it, or add /Applications/Keyboard Maestro.app/Contents/MacOS to your PATH, or you can link to it from /usr/local/bin with the command:

bash sudo ln -s '/Applications/Keyboard Maestro.app/Contents/MacOS/keyboardmeastro' /usr/local/bin/keyboardmeastro

Use --help to list out the argument options.

The command can pass a value to the macro (available via the %TriggerValue% token), and execute the macro asynchronously, or wait for the macro to finish, receiving a result (returned via the Return Result action) which is output the stdout.

Alternatively, the command can ask to edit the specified macro in the Keyboard Maestro editor.

URL Schemes

Editor

Another way you can control Keyboard Maestro editor is using the “keyboardmaestroURL scheme, which supports the following formats:

Example Editor URL Command Description
keyboardmaestro://u=support%40stairways.com/s=ABCDEFGH0123456789 Enter your username/serial number.
keyboardmaestro://m=Activate%20Application%20Switcher
keyboardmaestro://m=D2F427A1-51E3-4719-820B-4C25B6FF7329
Edit a specific macro or macro group.
You may used either the Macro Name, or UUID.
keyboardmaestro://q=Activate Filter macros with this keyword.
keyboardmaestro://g=All%20Macros/q=Activate Select a macro group and filter macros with this keyword.
keyboardmaestro://a=Execute Filter actions with this keyword.
keyboardmaestro://c=All%20Actions/a=Execute Select action category and filter actions with this keyword.

Triggers

You can trigger a macro (that is Active and Enabled) using the “kmtriggerURL scheme. The URL uses this format:

kmtrigger://macro=<Macro Name or UUID>[&<Trigger Value>]

where

  • <Macro Name or UUID> is either the Macro Name, OR, its UUID
  • <Trigger Value> is the optional Trigger Value
  • [ ] are not included. Used only to show optional parameters
  • & must precede the Trigger Value, if it is provided.

Note both Macro Name and Trigger Value must be URL encoded.

You can easily get the Trigger URL by clicking on the “Or by Script” Trigger option, and selecting “Or by URL”.

Example Trigger URL Command Description
kmtrigger://macro=Your%20Macro%20Name Using the Macro Name
kmtrigger://macro=224AA8CB-07EB-4C92-8201-68FED82B6E9F Using the Macro UUID
kmtrigger://macro=Your%20Macro%20Name&value=Your%20Trigger%20Value Using Macro Name with Trigger Value
kmtrigger://macro=224AA8CB-07EB-4C92-8201-68FED82B6E9F&value=Your%20Trigger%20Value Using Macro UUID with Trigger Value

The kmtrigger URL will only work on the local Mac, but you can use the Remote trigger to trigger macros with a URL even from remote locations via the Keyboard Maestro trigger server.

manual/URL_Schemes.1694572428.txt.gz · Last modified: 2023/09/12 22:33 by peternlewis