User Tools

Site Tools


token:TriggerValue

The %TriggerValue% token returns the value associated with how the macro was triggered.

Different ways of triggering the macro will set this field differently.

  • You can pass an explicit value in using the “with parameter” option when executing a script from AppleScript.
  • You can pass an explicit value in when using the Execute a Macro action.
  • You can pass an explicit value in when executing the macro via the web server.
  • You can pass an explicit value in when executing the macro via the kmtrigger URL.

When a Macro is triggered, the The %TriggerValue% token value will be based on the trigger:

Trigger Type %TriggerValue% token
Application trigger The Path to the application that was triggered.
Audio Output Changed trigger The name of the selected audio output device.
Cron trigger The current time and date (yyyy-mm-dd hh:mm).
Display Layout Changed trigger A comma separated list of the kinds of changes made.
Dragged File trigger The path of the dragged file.
Execute a Macro action Although Execute a Macro is not technically a trigger, when a Macro is executed by this method (the “Sub-Macro”), the %TriggerValue% token (as evaluated in the “Sub-Macro”) will be either of two values:
1. The %TriggerValue% of the calling (“Main”) Macro
OR
2. The value of the Parameter of the Execute a Macro, if a Parameter is provided.
Folder Trigger Path of the file that was added or removed.
Hot Key Trigger The key that was pressed.
Idle trigger The number of minutes the Mac has been idle.
MIDI trigger A comma separated list of channel,note,velocity,device.
Mounted Volume trigger The name of the volume.
Remote trigger The TriggerValue used in the Remote Trigger URL.
Script trigger Although not technically a trigger, when a Macro is executed via AppleScript the %TriggerValue% token will contain the passed parameter.
Status Menu or Palette The current modifiers (Note that Option means “edit this macro instead of triggering it”).
Trigger File trigger The path of the Trigger File.
Typed String trigger The exact text you typed to trigger.
URL trigger The TriggerValue used in the URL.
USB Device trigger The name of the device.
USB Device Key The key that was pressed.

To use the %TriggerValue% token in a numeric field, use the CALCULATE function: CALCULATE(%TriggerValue%).

You can easily access the individual parts using the token array notation, eg %TriggerValue[3]% will be the third comma-separated value, and %TriggerValue[3];% will be the third semicolon-separated value, and %TriggerValue[3] % (note the space between the ] and the %) will be the third space-separated value (8.0.4+).

See Also

Tokens

token/TriggerValue.txt · Last modified: 2021/11/24 01:41 by peternlewis