Jump to content

Simple ideas: I've got a little list… (2)


Recommended Posts

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

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