MACRO: Insert Token, v3.0

PURPOSE

This macro will paste a Keyboard Maestro token into a field that accepts text (or into the Clipboard if the cursor is not within a text field).

The macro begins by using a Prompt With List that includes all of the tokens and their respective descriptions. Once a token is selected, a dialog appears that presents three options for the format:

Format 1

%Token%

Format 2

Token [%Token%]

Format 3

Token
┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈
%Token%

Format 1 is typically used in a Set Variable to Text or If Then Else action, whereas Format 2 and Format 3 are typically used in a Display Text action, the latter useful when the token value may contain multiple lines.

Alternatively, the selected token documentation can be viewed if the Prompt For User Input dialog Wiki button is selected.

TESTED WITH

• Keyboard Maestro 10.2
• Sonoma beta 14.1 (23B73)/MacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445

VERSION HISTORY

( expand / collapse )

1.0 initial version

2.0 Added an option to view the selected token documentation in the Wiki.

2.1 Corrected a dialog box typographical error.

3.0
a) For Format 2 and Format 3 improved the token labels.

b) In the Prompt For User Input dialog improved the presentation of the current value of the selected token.


Download: Insert Token.kmmacros (63 KB)

Macro-Image


Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.

System Information
  • macOS 14.1 (23B73)
  • Keyboard Maestro v11.0

When the macro is triggered, a list of tokens/descriptions is displayed.


Unless View in Wiki (Shift key–⇧) or Format 1 (Command key–⌘) was specified when the token was selected above, a dialog will be displayed that is used to select the token format

Note that the format (or other options) can be selected by clicking one of the dialog buttons or using the keyboard:

  • Cancel : <esc> key
  • Wiki : w key
  • Format 3 : 3 key
  • Format 2 : 2 key
  • Format 1 : <return> key
8 Likes

Hey Jim! I like this idea... I just downloaded it so I can try it out today. I’ll report back once I’ve gotten the hang of it.

I've updated the OP with Version 2.0 of Insert Token: Added an option to view the selected token documentation in the Wiki.

1 Like

Hey Jim, fantastic macro. I forgot to reply back in August but I’ve been using it quite extensively ever since. I did strip some features out that I don’t use (like the different formats, mainly because I don’t know what I would need those other formats for) to simplify it, but it has been very useful. I like the option in version 2 of quickly accessing the Wiki entry as well, thanks for adding that!

Side note, I noticed a typo in the latest version. ↓

Type in user prompt (click to expand/collapse)

1 Like

Hi, @cdthomer. Glad you are finding it useful.

I use the other formats for debugging within Display Text or Prompt For User Input actions.

For others that don't plan to use to Format 2 or Format 3...

The dialog can be bypassed by pressing the Command key (⌘) when selecting the token from the list.

:+1:

Thanks! I fixed it and uploaded Version 2.1 in the OP of Insert Token.

1 Like

I've updated the OP with Version 3.0 of Insert Token:

  • For Format 2 and Format 3 improved the token labels.

  • In the Prompt For User Input dialog improved the presentation of the current value of the selected token.