Jump to content

Using keyword & chosen item from List Filter to skip manual list filter selection


Recommended Posts

I am in the process of creating an Alfred 3 workflow that uses a list filter option and the chosen option is passed into the script filter

 

So typing the first keyword umb triggers the list filter, where the user can choose from all, forum, documentation or packages

After choosing this option the user presses enter and then types in their search query which passes the query into the script filter which queries an API using a CURL script with BASH to return JSON

 

What I would like to achieve is the following, that a user types in umb forum followed immediately by the search query so umb forum inserting images so this allows users to choose what 

 

Here is a quick gif of what I am trying to describe
http://cl.ly/061V3L3p2v0w

 

Current Workflow, if anyone is able to download it & provide any help or pointers would be fantastic

http://cl.ly/0k0l1f441f2s

 

Cheers,
Warren

 

Link to comment

What I would like to achieve is the following, that a user types in umb forum followed immediately by the search query so umb forum inserting images so this allows users to choose what 

 

Cheers,

Warren

 

 

I think for what you are trying to achieve, you would be better served with just a Script Filter, instead of List Filter followed by a Script Filter.

 

If you set the keyword for your Script Filter to umb, your script filter will be passed the argument following the keyword for every key typed. You will be able to pass back the 4 categories, and when one of those matches, the results for that category. If you correctly set the autocomplete parameter for the 4 categories and set valid to no, then if you press return on one of the categories, it will auto complete ready for the argument for that item.

 

Hope this helps!

 

Andrew

Link to comment

Hi Andrew,
Thanks for the response. Shame I cannot do something with the visual workflow builder tools in Alfred itself. Just means that my hosted NodeJS API on WebTask.io or Azure Functions will require a fair bit more logic to check for the number of words by splitting on a space or similar to show the first four items if we only have one part and then as soon as we have two words items in the array when splitting the string with a space I can assume the remaining text is the search query.

 

Thanks again for the pointer, I will go back to hacking something.

 

Cheers,
Warren

Link to comment

To be honest, I think you'd do better to forget about bash and use a more powerful language for your workflows.

The query-splitting logic clearly belongs in the workflow.

One other option is to have 4 Script Filters with the keywords "umb all", "umb forum" etc. Alfred will show all four options when you enter "umb", and when you hit ENTER or TAB on one, Alfred will call the corresponding script to get that category's results.

Link to comment

Hello Deanishe,
I have gone with your approach and created 4 script filters instead. I only know NodeJS & C# so can't write it in PHP hence I have BASH just do a CURL to an Azure Function (Same as WebTask.io) a NodeJS bit of code to do what I need & return the JSON back for Alfred.

 

This is the best solution for me for now, rather than doing anymore logic by using a single script filter and checking for spaces to split on.

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