User Tools

Site Tools


Prompt For Snippet Action

The Prompt For Snippet action (v11.0+) allows you to create a snippet built from a template with fields entered when you execute the macro.

The snippet defines the template using the %Ask% token, which can include a size and a default value.

 Prompt For Snippet Action

The size is roughly the number of characters (default 20), or lines (default 5) if the token is on a line by itself, and the default value is either the specified value if : is the separator or the value of the specified variable if = is the separator.

This action produces a prompt like this:

 Prompt For Snippet Window

Output of Results

The results of the prompt can be:

  • Ignored.
  • Displayed in a floating window.
  • Displayed briefly in a Notification.
  • Displayed large across the screen.
  • Typed in to the current selection.
  • Pasted in to the current selection.
  • Saved to a variable.
  • Appended to a variable (v9.0+).
  • Saved to the system or a Named Clipboard.
  • Saved to a file (v11.0+).
  • Asynchronously ignored — the action runs while the macro continues on.

Result Button

The %PromptButton% token is set to the name of the button pressed, and can be used in actions later in this instance like any other text token. The deprecated Result Button variable is also set to the name of the button pressed.

⚠️ Note that the macro will terminate if you press the Cancel button, so to get any result other than OK you will need to use the Try or Catch action to catch the abort and continue anyway.

See Also



action/Prompt_for_Snippet.txt · Last modified: 2023/10/30 22:25 by peternlewis