Jump to content

Stephen_C

Community Hero
  • Posts

    1,347
  • Joined

  • Last visited

  • Days Won

    65

Posts posted by Stephen_C

  1. Background
    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
    SkeletalWorkflow.thumb.png.1b879395bd0cee18edcae5d2d51af7c4.png

    Explanation
    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.
    SetVars.thumb.png.f42a4cf467115a46ff3cc241b6ff03ac.png

    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.
    Text.thumb.png.3978d204202ba91c1079d232a2b6040c.png

    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:
    TextViewOptions.thumb.png.613785b5708f33cc2637c8fd41fd933b.png

    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:
    EditedText.thumb.png.3c9d00239bdd2323463a892d0fbfbc2b.png

    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. 😀

    Stephen

    The Simple Ideas posts

  2. Background
    Having feasted amply on the hidden delights of Alfred's Keyword Input it's time to be served a small palate cleanser.

    A good worklow holds the hand of the user—even if it's your workflow and your hand being held. The ultimate hand-holding lies in a good and comprehensive Workflow Configuration. However, that's for another day. Today we'll look at prompts, Alfred's Dialog Conditional and Post Notification Output...with a tiny addendum.

    As background to those it's very helpful to understand variables and how they are used.

    Prompting the user
    When we expect something from a user it's really important to be clear about exactly what we expect. We saw an example of that when considering Keyword Input—where the second Keyword Input used a variable as part of the prompt for the second part of the phrase.

    In a similar way, if we create a Universal Action we need to ensure it has a helpful title so that the user knows what it does.

    However, there's another way to prompt the user…

    The Dialog Conditional
    Alfred's Dialog Conditional is very useful for providing feedback to a user. It may provide the result of the workflow with some alternative actions as in this example from my Word and character count workflow (on the Alfred Gallery):
    WCCResult.thumb.png.7fc0d12145c91302cabd923426590ced.png

    Alternatively we can use it to warn users of any error which occurs in a workflow (for example, trying to delete a non-existent file). Here's an example from my Save 'ur note workflow (also on the Alfred Gallery):
    ErrorMessage.thumb.png.468660bb9b7fca904c5946f64915796b.png

    Error trapping is an integral part of a good workflow. A user is an unpredictable beast and entirely capable of wandering into a workflow and breaking it. We can't trap every error but it's worthwhile considering and trapping those most likely to occur. When we do that we should always provide to the user a helpful error message—and the Dialog Conditional is ideal for that.

    Notifications
    Neither we nor another user should be left in any doubt that a workflow has actually done something. Any workflow which saves something, adds something to the clipboard or otherwise ends silently having achieved its goal really should end with a notification reassuring the user of success.

    Here's another example from my Save 'ur note workflow:
    Notification.thumb.png.36a4ec95bffcf183f058e6d189b99393.png

    We have reassured the user that the workflow has done what was requested but have also provided reassurance that the deleted file is in the Trash (should the user…well, you know!).

    Addendum: notes
    I think we should annotate our workflows. I know I'm obsessive about that but annotations (right click on any Alfred object and choose Edit Note…) are really useful. It's easy to forget what something does in a workflow and a note will remind us. If users also learn something from the notes that's a Good Thing too.

    In conclusion
    Palate cleansers, prompts, Dialogs Conditional, notifications and notes are all small items in the greater scheme of things. However, the small often makes the good…

    Service charge included: no tip required.

    Stephen

    The Simple Ideas posts

  3. Background
    Alfred's Keyword Input is more versatile than you might at first suppose. Of course you can use a keyword without any argument: I use one like that to open a deeply nested menu item in Day One.

    However there's much more you can do with the Keyword Input.

    The skeletal workflow
    SkeletalWorkflow.thumb.png.045555405a2f674300d7c51a3c0ad495.png

    Explanation
    1. In order to set your teeth on edge we'll use the keyword Fraze. If we double click on the Keyword Input this is what we see:
    KeywordInput.png.10062fada8851e3729fe831e8569a657.png

    It shows the keyword we're using to trigger the workflow and indicates that should be followed by <space>, an argument then . The argument is the first part of the phrase.

    Note the title forms a helpful prompt we'll see when we trigger the workflow. Prompts are really important and helpful prompts really facilitate the use of workflows—so make use of them!

    If we trigger the workflow we can type the first part of our phrase:
    FirstPrompt.thumb.png.8a9cff9bc59dfdfbc1570e3ae18e40f3.png

    Note we've sensibly added a space at the end of the phrase because we know we're going to add a second part. However, never trust users! So, after…

    2. Telling Alfred not close his window (explained in this post)…

    3. We take control of spaces, decide to deal with them ourselves in order to avoid nasty surprises, so use an Automation Task simply configured (by double clicking on it) to remove trailing white space.

    4. We save the first part of the phrase to a variable:
    SaveFirstPart.thumb.png.54ca21bd96ddf90a5b5c46028081cfe9.png

    We use a variable because we want to take control of assembly of the phrase.

    5. It's time to prompt for the second part of the phrase and to reveal a very neat trick of Keyword Inputs:
    SecondInput.png.af458fbc99c6d03073b3ba124bb637ee.png

    This time we don't use any keyword. This Keyword Input is simply a device to collect more user input in the course of the workflow. We still require an argument (the second part of the phrase) so we leave that as is. Note again we have a helpful prompt. This one reminds the user of the first part of the phrase by using the variable we created in 4 above but with an added ellipsis and quotation marks.
    SecondPart.thumb.png.2f0e97e87b6d7868ce8a9a63beccc239.png

    6. After again telling Alfred not to close his window…

    7. We use another Automation Task to trim white space—but this time from the start of the second part of the phrase just in case a user has tried to be clever.

    8. At last we can assemble the whole phrase:
    Assembly.thumb.png.d0588dca17fbbdbe599ebc801ba82527.png

    Our variable introduces and quotes the phrase and takes control of the spacing between the two parts of the phrase.

    9. All we then need to do is to put our variable into Alfred's Large Type Output:
    LargeTypeVar.thumb.png.1be9419ad67a751f7248cb7cfd498b13.png

    so that when the workflow runs with our inputs it shows Your phrase is: 'Spam is significantly overrated'. You don't really need another screenshot just to show that it works, do you?

    In conclusion
    You can use a Keyword Input without a keyword to scoop up more user input in the course of a workflow—and, of course, you can do that as many times as you need. However, do remember to provide users with helpful prompts when they have to respond to any Keyword Input that requires user input.

    Stephen

    The Simple Ideas posts

  4. Background
    We know that Universal Actions can intelligently divine whether we are dealing with some text, a URL or files. So what's the point of having a trigger that's a specific Universal Action for files?

    Alfred's File Action Trigger in fact provides us with much more control when dealing with files than do more general Universal Actions.

    Open wide…let's pop in the skeletal workflow.

    The skeletal workflow
    SekeletalWorkflow.thumb.png.85c8c2d9200cfa079fd487c536017d8d.png

    Explanation
    We have a very simple workflow: all it's designed to do is to copy to the clipboard the contents of any single text or markdown file that we select.

    1. The File Action Trigger is the secret of this workflow. Here's what it looks like when we double click on it:
    TheFAT.thumb.png.598e4f95bcec2638e6ca67404fb680e1.png

    It allows us to restrict the types of files which, when selected, result in this workflow showing in our list of Universal Actions. Obviously we don't want to attempt to copy to the clipboard the contents of any binary files, for example, so we drag and drop into the Types: box samples of the files we do want to include. (If we use the + sign to add file types we're going to need to know the Uniform Type Identifier—UTI—of each file type that we add…so maybe drag and drop is easier in this case.)

    The Name: is what will appear in our list of relevant Universal Actions when we select an appropriate file so it's worth making sure we choose a helpful name.

    In this case we have selected Single Input Arguments because it makes little sense trying to copy to the clipboard the contents of multiple text files (the alternatives are Single and Multiple and Multiple: both of which are useful when dealing with operations like moving and copying files, for example).

    2. We link to a File Contents Automation Task—with no configuration of the task required—to retrieve the contents of the file so that…

    3. We can simply copy the contents of the selected text file to the clipboard.

    In conclusion
    Alfred's File Action Trigger, with its tailored, selective action, is very useful when you want a Universal Action linked to a specific file type (or, indeed, to various specific file types).

    We can stop chewing but some time—in the dim, distant future when the universe has expanded even more—we may again examine file actions in the context of a deconstructed workflow.

    Stephen

    The Simple Ideas posts

  5. Background
    We have dined upon cheese sandwiches and expanded the known universe but now it's time for a proper launch break.

    Alfred's Launch Apps & Files Action is extremely simple to use but there's a lot you can do with it.

    A skeletal workflow
    BasicLaunch.png.102eb18a45606988db6d8ecf37f1c115.png

    Explanation
    1. In the Hotkey: box we have chosen, as the Trigger behaviour, to Pass through modifier keys (Fastest). (For a detailed explanation of how to do that see this Simple Ideas post.)

    HotkeySettings.thumb.png.455e31560c7893916052267590fb9d12.png

    The Related Apps tab is empty—because we are trying to launch an app.

    2. We link the hotkey to the Launch Apps & Files Action which, when we double click it, looks like this:
    TheApp.thumb.png.9eff6f170c9f6893493943f4f3b95251.png

    We have added the Messages app by dragging and dropping it into the relevant box. (That is a complete lie: I hate drag and drop so I clicked the little + sign and "did it my way”.) Note that we've ticked the box to Toggle visibility for apps. That means that we can use the hotkey to toggle the display of the Messages app: click to display, click again to hide.

    That's it: launch is all done and dusted…but is it? There is, in fact, another course (or two).

    Riffing launch
    You can add more than one app to the Launch Action: so it's very easy, for example, to launch all your chat apps at the start of the day with one hotkey.

    I do some photography and use both Adobe DNG Converter to process RAW files and Photo Mechanic Plus to enter metadata. When I want to process photos I need both of those apps but the first app I'll use is the Adobe one. If I launch both at the same time Photo Mechanic Plus will remain on top because it takes longer to launch. However, I can still use one hotkey to launch both apps because I simply separate the two launch actions (the first for Photo Mechanic Plus, the second for the Adobe app) with Alfred's Delay Utility set for a five second delay.

    Do you need regularly to open the same selection of files? Remember, the Launch Action is not merely for apps. Populate the Launch Action with the paths to the files you need to open (much easier to use that little + sign 😉), precede it with your hotkey, press the hotkey and your files are served.

    Of course, you don't have to use a hotkey trigger with the Launch Action. If, like me, you find it hard to remember all the hotkeys used on your Mac there's nothing wrong with using a Keyword Input.

    It may be worth pointing out that you can simply have a category called 'Launch Apps', or some such, in your workflows and put all your app launchers together on one page in Alfred's workflows.

    In conclusion
    Launch is ended, the table is cleared—and I trust no indigestion tablets are required.

    Stephen

    The Simple Ideas posts

  6. 22 minutes ago, sepulchra said:

    Come to this side of the pool, this water is warm!

    <Drowning noises off>

     

    I, too, moved from TextExpander the moment it went subscription. But, really, I'd be hard put to abandon Typinator: I have so much in it, including "mini-programs" that Do Things™️.

     

    While my brain is certainly small enough to fit in a Snippet 😁 I have reason to suppose you might be well qualified to prepare some sort of presentation on Snippets. 😉

     

    Stephen

  7. Background
    Approximately 13.8 billion years ago the universe exploded from a hot, dense soup of sub-atomic particles and has been expanding ever since. You are part of the expanding universe.

    Approximately 32 months ago Universal Actions exploded from Alfred 4.5 and have been expanding ever since. You can also be part of expanding Universal Actions: find out how—and why—it's better not to remain in a hot, dense state.

    There are few skeletons (just one) in this tiny cupboard in the universe: we don't start with a skeletal workflow. We have—horror—a non-standard layout for this "Simple Ideas” post.

    What are Universal Actions?
    At its most basic a Universal Action is an action in Alfred that acts on something you have selected: a file, a URL or text. However a Universal Action can also act on Alfred's results, file navigation or clipboard history (see below).

    Alfred has a large list of inbuilt Universal Actions. You can see them by opening Alfred Preferences → Features → Universal Actions and clicking on the Actions tab. While you're there you can un-check any that you don't want to see.

    How do I use a Universal Action?
    1. You can first select something (a file, a URL or some text) to use a Universal Action. When you have done so you can use your Universal Actions Selection Hotkey (go to  Alfred Preferences → Features → Universal Actions: it's ⌘/ by default) and that will display a list of Universal Actions relevant to what you have selected (i.e., text, file or URL).
    2. You can also use Universal Actions on Alfred's search results, File Navigation and Clipboard History. In those cases, simply use your Actions shortcut to show the Universal Actions relevant to the appropriate item. (The Actions key is set in  Alfred Preferences → Features → Universal Actions under Show Actions: and is by default.)

    Here's what I see when I use Alfred to go to my ~/Downloads folder and then use :
    SearchView.thumb.png.d9dffb84160f89bc738d8e6dc16f0e6a.png

    (Your view will not be identical because you'll not have the same Universal Actions. Note also that Alfred remembers which Universal Actions you last used so the results will be ordered accordingly.)

    If I use Clipboard History, choose an item with text on the clipboard and press I see this:
    ClipboardTextView.thumb.png.c2632cee01978191c95e3b02a041dbd5.png

    Note that Alfred knows whether what you have selected is a folder or text (or, indeed, a URL). The beauty of Alfred's Universal Actions is that they're omnipresent (the clue may be in the name), intelligent and instantly accessible.

    I want to live in my own universe: how do I create a Universal Action?
    This is very easy. Here's a really simple example which converts text to lower case <produces following skeleton from cupboard>:
    Workflow.png.77dfb6b6267bc849833cdfedc606388e.png

    We start with a Universal Action (which is probably not a major surprise to alert readers):
    TheUA.thumb.png.c688b2a7a1b534f52872ce7e41792ea4.png

    We give it a name (remember, that's what's going to appear in our list of Universal Actions whenever, one way or another, we select some text), choose Text as its target and Single Input Arguments. (The alternatives are Single, Single and Multiple and Multiple: you can imagine the latter two are particularly useful when we're dealing with files, for example.)

    2. Connected to the smart little Transform Utility
    Transform.png.415b4335d0012ecf365cf0a2975a5a9a.png

    3. …we simply then copy the result to the clipboard by using the Copy to Clipboard action in its default state.

     

    The result, of course, is that any capital letters in the text are now converted to lower case (you don't really need another screen shot, do you?).

    In conclusion
    27% of the Alfred workflows I use (numbering just over 100) are Universal Actions (or use a Universal Action in addition to another trigger). Those of course, are in addition to Alfred's inbuilt Universal Actions. Perhaps that's some indication of their usefulness…and it didn't take (even) me 13.8 billion years (or even 32 months) to build them.

    P.S. Alfred's File Action Trigger is important in the context of Universal Actions but you will be relieved to know there is a limit to the amount that should be crammed into one post so that will be the subject of a separate post…at some time.

    Stephen

    The Simple Ideas posts

  8. Background
    This is the second of two posts exploring uses of Alfred's List Filter Input. The first post is here.

    Like the first post this workflow is not intended, of itself, to be useful but, rather, to provide a gentle introduction to use of Alfred's List Filter Input and to Using Variables in Workflows. (If you're new to variables it might be helpful to read this post first.)

    There are two things you need to know before proceeding. First, this workflow uses Alfred 5.5's Text View. Second, we're going to be working with markdown—but all you need to know about that is that to create a valid markdown link you have to use the format [The friendly name](The URL).

    The skeletal workflow
    SkeletalWorkflow.thumb.png.e76ca83bdf4c014332cb138860f20a5e.png

    Explanation
    1. We're using Alfred's Alternative Actions and keeping Alfred's window open (see also this post).

    2. This time we're going to use both variables from the selected list filter item (and I selected again—as in the first postThe Debugger). The list filter for that item shows the arguments as https://www.alfredapp.com/help/workflows/advanced/debugger/,the debugger.

    In order to use both variables sensibly we split them so we can assign them to meaningful variable names.
    SplitVars.thumb.png.ba3b6560ac6bc8fbeee71eea18bb2c60.png

    This time we split them into variables and assign the prefix split.

    3. Now we have the two variables we can prepare them ready to create the markdown link. Remember, we need [Friendly name](URL). At the moment we have two variables: split1 and split2. The first is going to be the URL so we create a new variable called, unsurprisingly, theURL and assign to that {var:split1}. In a similar way we assign to a new variable called theName our second split variable {var:split2}.
    CreateVars.thumb.png.ed5d4a90cc6fb91b8180ddf4e3c7dc3e.png

    Don't fall into the trap of referring simply to split1 and split2: you must tell Alfred these are variables and not merely pieces of text. (However, when, not if, you make that mistake and wonder at the strange result rest assured we've all been there.)

    4. It's very easy now to create our markdown link by assembling our two variables and assigning them to a new variable:
    CreateLink.thumb.png.b969509b3c1bcc20186b476b7d6e0e08.png

    Note we are not using just the variables themselves. We add the relevant parentheses around them necessary to create the markdown link. Alfred simply treats those parentheses as pieces of text and reproduces them as such.

    Remember, we can't spit out a newly created variable from the Arg and Vars Utility in which it was created so (not passing anything through from this Arg and Vars Utility)…

    5. We simply tell Alfred to pass on our new variable using another Arg and Vars Utility:
    PassLink.thumb.png.f18985277d74a07aaf94bceb3bc6aa54.png

    6. At long last (for those of you still awake at the back there) we have a clickable markdown link displayed in Alfred's Text View:
    Markdown.thumb.png.4a98ed3561219d2aefe18eacda835c7f.png

    In conclusion
    Sorry there was no time to serve the popcorn: there was much ground to cover. While superficially it may seem pretty basic stuff there's an awful lot you can do with simple variables, combinations of them and addition of text to them—as well as by using List Filters with multiple arguments.

    What's my use for a variation of this workflow? Ah, that's for another time.

    Stephen

    The Simple Ideas posts

  9. Background
    Do not be frightened of variables! Variables are nothing more than little titbits saved in a pocket for future use—just like cheese sandwiches.

    Except, except…you wouldn't put a cheese sandwich straight into your pocket, would you? First you'd tenderly wrap it to preserve its identity through the vicissitudes of pocket travel. So you won't be surprised to know that variables are exactly like cheese sandwiches: they need wrapping too.

    The skeletal workflow
    SkeletalWorkflow.thumb.png.15d2a99dfcc51d1953698e40b6f0916e.png

    Explanation
    This is a quick and reasonably useless workflow purely to demonstrate use of variables: please excuse both it and me.

    1. We have a Universal Action limited to URLs (and we'll talk more about Universal Actions another day). All we do is to select a URL (remember, you always need to select something before using a Universal Action), press our Universal Actions hotkey, chose "Copy the URL” and press :
    CopyURL.thumb.png.da96c2dca51f542f0fb2872e294f710b.png

    2. We don't want to close the Alfred window (which we covered in this post).

    3. We're going to need to use the URL later in the workflow so we must pocket it in order not to lose it. That's what we do here:
    SaveURL.thumb.png.7afc696952a3b6d8dcbcad19962e0556.png

    We use Alfred's Arg and Vars Utility. When we first open it {query} appears in the top box after Argument:. {query}, in this case, is the URL we just copied. We don't want to pass that on directly to the next item (the prompt for a friendly name) because if we do the URL will appear in the prompt field we have to complete. So we delete {query} if it appears after Argument:.

    What we do need to do is to save the URL as a variable. To do that we click on the + sign at the bottom of the Variables: box. First we give the variable a sensible name. That's important because we want easily to be able to recall what we called it. You can use any form of name you like—although I tend to use Camel case as here. After we've named the variable we must indicate what it contains. In this case it's very simple: {query} is what Alfred passed in to this Arg and Vars utility, so {query} is the URL and that's what we want to save to the variable.

    4. Now, for the first time we're going to use a variable <cue sound of distant trumpets>. The prompt for the URL friendly name is this:

    Friendly name for '{var:theURL}'

    (Note you can use variables in prompts like that—as well as in things like notifications and dialogs—to make them more helpful.)

    It's very important to note that when we use a variable we must use its wrapped-up form so that Alfred recognises it as a variable. That form is {var:variableName}: so the only thing that changes from case to case is variableName.

    In this case we've encased the variable in single quotation marks simply to make look better in the prompt:
    FriendlyPrompt.thumb.png.aa6adf9b5dcc84e677ab50f01e5b6448.png

    5. We don't close Alfred's window.

    6. Now, in a blaze of glory and another Arg and Vars Utility, we assemble the final text:
    Assembly.thumb.png.fe1c500b1cc6c7926407b77ee93b6943.png

    We use the saved URL ({var:theURL}), the friendly name (which Alfred has passed us as {query}) and a little bit of text between them.

    We want to pass the text to Alfred 5.5's Text View but we can't pass out a new created variable from the Arg and Vars Utility that created it so, while ensuring this Arg and Vars Utility is not passing out anything (blank Argument:, unchecked Pass through input argument), we…

    7. Pass the text with another Arg and Vars Utility:
    PassText.thumb.png.cb9fd250b591e94ae8e2101a8ec32d8d.png

    Note, again, that the variable we saved as theText must appear here as a wrapped variable Alfred will recognise: {var:theText}.

    8. Finally…in Alfred's text view {var:theText} is translated into Real (if uninspiring) English:
    Result.thumb.png.e1c0a747ae779afbf7b2ed8f05dfa150.png

    In conclusion
    This was intended to be a short post but, obsessed with the variables of cheese and Spam and the need to provide a foundation for future simple ideas, it has not been so. I apologise. Please take a break, choose your favourite sandwich and munch while meditating upon the delights of variables.

     

    Stephen

     

    The Simple Ideas posts

  10. @sepulchra thanks for the ideas…but I think we need to come to some sort of arrangement. You see, I'm a little ashamed to admit that I don't use Snippets (I've used Typinator for years) so I think you should do the ones involving Snippets. 😀

     

    However, I shall adopt Vitor's suggestion for a deconstruction of some of my non-code workflows—and, in doing that, cater for some of the ideas you mentioned. I'll just cover a little more basic stuff first and then, when we have all the building blocks in place, start with some of my basic workflows.

     

    Please feel free to continue to comment (your comments are always valuable) and to contribute anything along the same lines!

     

    Stephen

  11. I am aware that Simple Ideas appears to have grown like Topsy. That was not originally intended but it seems now to have a life of its own. I apologise to those who find the posts tedious and too basic. They're not designed for those who chat in JSON and JavaScript over the supper table. If you are one of those people do please ignore the posts to avoid distress.

    I aim to post only on aspects of Alfred about which I have some basic understanding—which clearly bars me from any dive into Alfred's depths. I try to think of the posts in terms of what would have helped me when I first nervously dabbled trying to write workflows.

    Yet to come:

    • Variables and cheese sandwiches
    • I've got a little list…(2)
    • Goodness knows what else (which means I don't)


    Ideas and comments are welcome—but please don't expect anything too sophisticated!

    Stephen

  12. Background
    This is the first of two posts exploring uses of Alfred's List Filter Input. If you don't know about List Filters do check the link because (a) they are very useful and (b) I shan't cover every aspect of them in these posts.

    This is not intended to be, of itself, a useful workflow but, rather, to show how List Filters may be used.

    The skeletal workflow
    SkeletalWorkflow.thumb.png.333f572a19f611fcdce5e92d1a302739.png

    Explanation
    1. The List Filter starts the workflow and shows the keyword used to trigger it (ahp in this case). (If you sometimes see a keyword in italics that is because the keyword has been set in the Workflow Configuration.) Here's what the List Filter looks like when you double click on it:
    ListFilter.thumb.png.6e158eaedd1d0df99e83708f813d3340.png

    Note, at the top of the List Filter, we choose to have the keyword followed by a space and an optional argument. That allows us to see the entire list of items as soon as we type the keyword—and to press space followed by a typed search term to display the item we want. At the bottom right of the List Filter we choose "Alfred learns result order based on usage” so that frequently used items rise to the top of the list as we use the workflow (see Understanding Result Ordering).

    The key thing to note is that each item in the list has two arguments separated only by a comma. The first argument is a URL for an Alfred help page and the second argument is a friendly name for the page. The significance of the second argument will become apparent in the second of these posts.

    2. Because we have two arguments for each item in the list and because for the purposes of this post we're going to use only one we use Alfred's Split Arg Utility to split the two arguments. Here's what it looks like when we double click it:
    SplitArg.thumb.png.151fc94f95cc4f92e2bddb46bfc8836b.png

    We split with a comma (because that's how the arguments in the list are divided) and we output as arguments (because that's what we need in the next part of the workflow).

    3. All we need is the URL (at the moment) so we just use a simple Automation Task to grab the first argument—with no Automation Task configuration needed.

    4. We're home and dry! The URL is passed to the Open URL Action—which we have no need to modify if we wish the URL to open in our default browser.

    In conclusion
    I appreciate none of that is very exciting. However, in the next post we'll start messing around with some simple variables and use both of the arguments in the List Filter. Sadly no popcorn will be served but please remain in your seats.

    Stephen

×
×
  • Create New...