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 #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
kind | one of | url email path json date phone number code word multiline | The kind of text the whole selection must be. Leave it out to test only matches. | |
matches | text | A regular expression the selection must contain a match for (^ABC-\d+$). An invalid pattern fails the condition with the problem named. |
Examples #
- If the selection is anything matching “^[A-Z]+-\d+$”
- Show “Ticket {{text}}”
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 anifstep.Nothing selected: the condition fails.