Browse the docs

Selection is

Passes when the selected text is a given kind of thing: a link, an email address, a file path, JSON, a date, a phone number, a number, code, a single word or several lines. Optionally it must also match a pattern.

The selection is kind

Details #

Reads the text in {{sel}} (or, when the run has none, {{thing}}), and asks the same recognizers Current thing uses. Inside a macro that shows on the selection bar the run already holds the selection, so the condition costs nothing. Anywhere else it reads the selection in the front app, the way Get the current thing does.

Kinds: url, email, path (a file or folder that exists), json, date, phone, number (a plain number, or a number with a unit or currency), code, word (no spaces) and multiline.

Every condition accepts "negate": true.

Parameters #

ParameterTypeRequiredValuesWhat it does
kindone ofurl email path json date phone number code word multilineThe kind of text the whole selection must be. Leave it out to test only matches.
matchestextA regular expression the selection must contain a match for (^ABC-\d+$). An invalid pattern fails the condition with the problem named.

Examples #

Only for a ticket id
Only if
  1. If the selection is anything matching “^[A-Z]+-\d+$”
Do
  1. Show “Ticket {{text}}”
Open in Switchboard to try it

Gotchas #

  • Reading the selection can copy and restore the clipboard, so this condition can't be watched (wait.until, States); use it in Only if or an if step.

  • Nothing selected: the condition fails.

See also #