You possibly can catch the enter from the command line by checking the Use as fast motion
choice. You do not want to test any suboptions reminiscent of Finder
or Providers menu
.
- Create new shortcut within the Shortcuts app.
- Give the shortcut a correct title, I’ll use the title
Instance shortcut title
right here. - Click on the
(i)
within the sidebar on the best and testUse as fast motion
. AObtain
enter block ought to seem on the Shortcuts canvas, set toObtain [...] enter from [Quick Actions]
. - Set the content material kind you want to obtain to
Textual content
. The block ought to now sayObtain [Text] enter from [Quick Actions]
. - Now test the
Present output
choice in the best sidebar. ACease and Output
block seems on the canvas. - Set the output to
Shortcut enter
, which means it’s going to output what (textual content) the shortcut acquired. - To exhibit textual content manipulation, drag in a
Exchange textual content
block in between the enter and output blocks, set it to switch textual contentnoes
withhai
.
There at the moment are 3 ways to offer the shortcuts
command line instrument along with your enter. On this case the shortcut we have created outputs plain textual content. So we’ll want a trick to disclose what textual content shortcuts
returns: put | tee
on the finish of each command.
Passing textual content: utilizing stdin redirect
On this instance, the <<<
redirect places the string Oh hai
into the stdin of the shortcuts
command.
$ shortcuts run 'Instance shortcut title' <<< "Oh noes" | tee
Oh hai
Passing textual content: pipe textual content and set --input-path
to stdin
On this case we echo
our textual content, pipe it to shortcuts
, which we offer with the -i
or --input-path
choice, and we set that choice to -
which suggests stdin. The title of the choice --input-path
is deceptive in that sense, as it will probably additionally settle for textual content. --input
might have been a greater illustration.
$ echo "Oh noes" | shortcuts run 'Instance shortcut title' -i - | tee
Oh hai
Passing information: use -i
or --input-path
and a filename
If we do not set --input-path
to stdin, it is ready to settle for a filename or a path. I’ve not examined this by however it seems that, for instance, the Extract Textual content from Picture
block will decide up textual content as a filename to a picture.
This instance would take the trail of a picture file and output the extracted OCR textual content to the terminal:
$ shortcuts run 'Get textual content from picture' --input-path image-with-text.jpg --output-type public.plain-text | tee
Lorum ipsum
The public.plain-text
is a “Uniform Sort Identifier” and you’ll search to discover a full record of these for the macOS model you’re working. For some shortcuts, specifying the output kind may be the distinction between getting again plain textual content or, for instance, uncooked knowledge.