Browse the docs

triggerValue

What the trigger handed to the run, such as the typed text or the file path.

Keyboard Maestro: TriggerValue

Details #

Use it anywhere a {{ }} expression is allowed, as {{triggerValue}} in a step's text or as triggerValue inside a longer expression. It also works as a call, triggerValue(). It holds the one most useful piece of the event that started the run. Switchboard takes the first of these that the event has:

  1. a triggerValue the event set explicitly

  2. value

  3. path (a file trigger)

  4. string (what you typed for a typed-string trigger)

  5. title (a window title trigger)

  6. keys (a hotkey trigger)

  7. route (a URL or webhook trigger)

If the event has none of these, as when you run a macro by hand, the result is an empty string.

A run variable with the same name wins. If a step stores something in a variable called triggerValue, {{triggerValue}} reads that variable, not the live value. Name your own variables something else.

Parameters #

Write it as {{triggerValue}} in any text field. A variable of the same name wins.

Examples #

"You typed: " + triggerValue
→ You typed: ;sig
Sample variableValue
triggerValue;sig
Show what a file trigger saw
When
  1. A file is created in ~/Downloads
Do
  1. Show “New file: {{triggerValue}}”
Open in Switchboard to try it

Gotchas #

  • A macro's Only if is checked once before any run exists, and there triggerValue is empty. Test it inside an if step instead.

  • Triggers that don't hand over a value, such as wake or unlock, leave it empty.

See also #