Jump to content

Anyway to delay script filter from running (ie. wait until user has stopped typing or at least paused)

Recommended Posts

Good news.



What would this mean precisely? Alfred waits until, say, 100ms after the user last pressed a key before (killing and) running the Script Filter?


Also, how would you kill the process? With SIGTERM?


The delay would be pretty much that yep, and it would be SIGTERM as this is what the NSTask sends when using the terminate method.

Link to comment

What's the proposed model for stdin?


Alfred keeps feeding in query on a new line every time it changes?


Would that mean workflows can output multiple XML documents?


I havent decided yet, I'll probably post a topic when it becomes relevant to get a bit of input.

Link to comment

Here are the options you'll now see from a "Script Behaviour" button in the Script Filter workflow preferences...


This will give you the same behaviour as current Script Filters:




This will wait until 300ms after the user has finished typing, terminate the currently running script for this Script Filter (if it is running), then run the script with the latest query:




This will make it into Alfred 2.6 if I'm happy that it's working robustly and as expected.




Link to comment

Very happy to hear that. I reckon that will come in handy.


It'll be interesting to see how Queue Delay works in practice: I've always wondered whether that should be a workflow- or a user-specific value or some arcane combination of the two.


I guess I should start thinking about whether to build signal handling into Alfred-Workflow…

Link to comment

To be fair... PHP is not the greatest language for scripts like these. Due to the monolythic core it's too heavy to start/stop constantly. It works but it's far from ideal... :P

Anyone that's serious about programming should give at least one of the different scripting languages like python and ruby a try. After using that for a bit you'll never switch back willingly ;)

Link to comment

Quick update, this is going to be a little more clever now...




There will still be a custom fixed delay mode for if it suits your workflow better.


Very, very interesting feature.


It’s kind of sad that Evernote app 5.6+  kind of broke my workflow but I’ll make some tests to take advantage of the delay.


I can see that my rename workflow can be more responsive when managing lots of files because it creates an HTML preview every time the script runs and now I can control that in a better way.


Thank you. Great feature.

Link to comment
  • 4 weeks later...

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