Get the current thing
Reads what you are on (selected text, the Finder selection, the browser tab, the Mail message or the element under the pointer) as a typed thing.
Get the current thing from source
Details #
Answers "what am I on?" for a macro that started some other way (a hotkey, a menu item, a schedule). The step looks in order, and the first place that has something wins:
the text selected in the front app (read through Accessibility first, then by copying and putting the clipboard back);
the Finder selection, when Finder is in front: each file is a
filething;the front browser tab: a
urlthing with the page title;the selected Mail message: a
mail.messagething with sender, subject and message id;the Accessibility element under the pointer.
Text goes through the recognizers: the built-in ones and the ones you teach in Library ▸ Thing Types. "Call 555-1234 about ABC-12" is a phone number, and a ticket, and text. The best match is the thing; the others are its alternatives; the whole text is always the last.
The step leaves the thing under into as {value, type, label, source, fields, alternatives}, and sets the run's {{thing}} (the value), {{thing.type}}, {{thing.label}}, {{thing.source}} and {{thing.<field>}}, the same variables a macro that takes a thing starts with.
Parameters #
| Parameter | Type | Required | Values | What it does |
|---|---|---|---|---|
into | text | A variable that receives the thing. | ||
required | yes / no | Fail the step when there is nothing to act on. Otherwise the step succeeds with an empty result. | ||
source | one of | auto selection finder browser mail element clipboard | auto (default), selection, finder, browser, mail, element or clipboard. A named source reads only that one. |
Every step also accepts label, onFailure, timeout and dryRunSafe.
Examples #
- Get the current thing from selection
- If the current thing is a link
- Open {{thing}}
Gotchas #
Dry run. Reading the selection can copy and restore the clipboard, so a dry run doesn't do it.
The copy-and-restore fallback is skipped in secure input (a password field) and in the Finder, and the whole read gives up after about half a second.
Clipboard history and the
clipboardtrigger ignore the transient copy.