sel
The text selected when a snippet was run from the palette or a hotkey. Always empty when you type the abbreviation.
Details #
sel() stands for the text you had selected in the front app when the snippet was run from the palette or a hotkey. Typing an abbreviation replaces the selection with the first letter you type, so by the time an abbreviation fires nothing is selected and {{sel}} is empty there. In a snippet body it is written as the token {{sel}}. To read the selection, Switchboard copies it with ⌘C into a transient clipboard and puts your clipboard back afterwards. With nothing selected it is empty.
To wrap a selection, run the snippet from the palette (⌥Space, then ; and the name) or give the macro a hotkey in the block editor.
A snippet can wrap the selection: <b>{{sel}}</b>{{cursor}} or "{{sel}}".
Parameters #
Write it as {{sel}} in any text field. A variable of the same name wins.
Gotchas #
ask,cursorandselwork only in the text of a Type Text step. Anywhere else they fail with "only in a snippet body".Off under secure input (a password field): nothing is read and the snippet does not run there.
The selection is never recased by
matchCase.