User Tools

Site Tools


action:Prompt_for_Snippet

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 a shell script 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.
  • 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

Actions

Tokens

action/Prompt_for_Snippet.txt · Last modified: 2023/09/14 00:00 by peternlewis