Jump to content

Script Filter - Alfred Filters Results - any way to avoid re-running the script when the user backspaces all the way to the start of Alfred's input box?


Recommended Posts

I've got a workflow that I'm trying to wrap up to be publicly released, but one question I can't figure out is:

 

I am using a script filter that fetches results from an API which can be slow. So I use the Alfred filters results option so the script is not re-run on every keypress. This works perfectly, except if the user types a search term, then later backspaces all the way back to the beginning. At that point, instead of just displaying the original JSON results, it re-runs the script.

 

To work around this, I set a timeout (2 minutes by default) and just cache the entire JSON. If this cache is found and fresh, it just runs cat $my_json_file instead of executing the script. That feels like a hack and I'd rather avoid it.

 

Is there any way to tell Alfred or configure the ScriptFilter so it does NOT re-run upon backspacing to the beginning of the input box?

Link to comment

@Andrew Yes I did see that and I played around a bit, but of course can't remember (now) why I chose my own method instead. It could very well be that the native caching would work fine and I will try it again for sure.

 

Back to the original question though- any reason that the script re-executes when backing the cursor up to position 0 in Alfred's entry field?

 

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