Jump to content

Text on a plate—Alfred 5.5's Text View

Recommended Posts

Alfred has several ways of displaying text: it can be copied to the clipboard or displayed in a Dialog Conditional or in a Large Type Output.

Alfred 5.5 has introduced a Text View object. We passed over it when discussing variables and cheese sandwiches but shall now take another look at the Text View revolution—enabling us to have text served to us on a plate.

The skeletal workflow

The workflow is simple. It allows us to select some text then places quotation marks around the text before displaying the result to us—allowing us to edit it. (It's very basic but is part of a rather useful workflow I use to send messages to people quoting parts of articles that I have read.)

1. We have a Universal Action limited to text. So we select some text and run the 'Quote selected text' Universal Action.

2. We don't close Alfred's window (explained in this Simple Ideas post).

3. We'll use an Arg and Vars Utility to save the text as a variable and set opening and closing quotation marks. (See this Simple Ideas post for more on variables.) The selected text is passed in by Alfred as {query} so that's what we use when setting the selectedText variable. We're also setting opening and closing quotation mark variables—because we want to ensure we use smart quotation marks (we paste those in when creating the two variables). Note we're not passing out anything from this Arg and Vars Utility.

4.  We use another Arg and Vars Utility to create a variable called quotedText—the contents of which are simply {var:openQuote}{var:selectedText}{var:closeQuote} (without any spaces between the variables of course). Again we pass nothing out of this Arg and Vars Utility.

5. Here we simply pass on (in the Arguments: box) {var:quotedText} (which we created in the previous step)—because we want to feed the text to Alfred's Text View…

6. Thus, here, in Alfred's Text View, is our quoted text.

Note the prompts at the bottom of the window: to continue, ⌥↩ to edit the text and Esc to end the workflow.

Rather more interestingly this is what we see when we double click on the Text View object:

We've chosen Object Input as the source (the alternatives are Script and File) because we're using 5 above to input the text to Text View. For Behaviour: we select Selectable (rather than Editable or Markdown). That means we can select and copy text in the window but we can't edit it.

Text Size: and Font: are left at their default settings.

Footer Text: is important—because it's what the user sees at the bottom of the Text View window when viewing the text (and we've already seen the importance of feeding the user). Note that we have added the footer text that we want the user to see.

We can press simply to proceed and show the quoted text in large type. However, if we press ⌥⏎

7. We keep Alfred's window open and move to…

8. A Text View window where we can edit the text:

Note that in this Text View object for Behaviour: we have selected Editable rather than merely Selectable—and the only other things we have altered are the prompts at the bottom of the screen so that  allows us to edit the text and

9. ⌥⏎ continues. (We use a modifier key for the alternative action.)

10. We save the output of the Text View object to a variable called theMessage so that…

11. In the Large Type Output we simply put {var:theMessage} in order to have the quoted (and possibly edited) text displayed.

In conclusion
If you want Alfred to serve your text on a plate (and optionally make it editable) the Text View object is the way to go. Of course, it's hugely more versatile than that (see what Vitor did with it in the ChatGPT/DALL-E workflow on the Alfred Gallery, for example). On a much more modest level it can be used for multi-line inputs to Alfred (you can see my Save 'ur note workflow if you want an example of that). But these posts are for "Simple Ideas” so we try to not to go too much over the top. 😀


The Simple Ideas posts

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...