Jump to content

Help with working with List Filter


Recommended Posts

Here is the workflow I want to modify : https://transfer.sh/Cj2ht/knowledge-map.alfredworkflow 

 

I want to make a List Filter that will activate a script filter depending on what result was chosen. So if I have a list filter like so : 

 

qbSz5Q4.png 

 

If I activate on 'learn anything' it will pass 'learn' as query and then activate the script filter with 'learn' spelled out in Alfred. 

 

How can I filter through each of the 'list filter items' and fire off certain script filters depending on what item was activated without having this issue of it passing something to a script filter and opening a non empty script filter prompt?

Edited by nikivi
Link to comment

You can cheat. Add an Args and Vars between the Filter and the Script Filter and leave its Argument box empty. It’ll still pick the correct direction, but then continue without passing anything.

 

Although on the other hand, since this workflow is mostly for yourself and about your mind maps, maybe the Script Filter should be replaced with another List Filter. Change the loop to something like

for line in $(grep --extended-regexp '\[.+\]\(.+\)' < 'learning.md'); do
  sed -E "s|.*\[(.+)\]\((.+)\).*|\1,,\2|" <<< "${line}"
done > some_output_file.csv

And it’ll create a some_output_file.csv that you can just drop on the new List Filter. But that would either need to be rebuilt every time you make changes to the original file (a pain if you update it frequently) or be done on the fly by the workflow every time (may be a bit slower, and seems a bit wasteful).

 

Thank you for the note on the README, by the way. It was a fun note to read.

Link to comment

Thank you a lot. It's working amazing now. :)

 

One thing however that is strange is one of the objects doesn't seem to trigger after an argument is passed and I have no idea why as the argument that the filter catches should be correct.

 

If you have the time, here is new updated workflow : https://transfer.sh/1EXbw/knowledge-map.alfredworkflow

 

The part not working is 'images'. It should show a list from the script filter but it doesn't show anything. However if I just use it like this :

 

ffgZh6h.png 

 

It works. 

Edited by nikivi
Link to comment

Also I think I broke Alfred. When I start the prompt, all I get is this : 

 

IuF2B4u.png 

 

I get no mouse cursor, can't type anything. The only fix for this is to restart Alfred I guess. :( 

 

Have been having these weird glitches quite often with Alfred but I should probably move this issue to 'bugs' rather than have this here. 

 

I also often get moments where I can't even call Alfred at all. I press my hotkey trigger and nothing shows up, nor can I use any of the workflows. The only solution is to go to Activity Monitor, force quit Alfred and start again. It doesn't happen too often (maybe once in two-three days, but still is incredibly annoying).

 

Perhaps that maybe the reason why the above workflow is not working for me? I really think I did everything right, it passes 'images' as arg : 

 

7GC6B3q.png 

 

The argument filter catches 'images' too : 

 

Cod38jI.png 

 

And yet when I activate on 'images' alfred prompt just dismisses. :( 

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