Jump to content

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


Recommended Posts

Posted

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.

Posted

Yay, thank you Andrew. :) You have probably mentioned this elsewhere, but what's your rough timeline for the 2.6 release?

 

I'm aiming to have 2.6 in pre-release before January and released within the first few weeks of Jan :)

Posted

Andrew, can I propose another option? Just pass everything along through stdin :)

With an EOF when Alfred closes.

 

I have a note for this, but this is unlikely to make it into 2.6

Posted

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?

Posted

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.

Posted

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:

 

script%20filter%20queue%20options%202.pn

 

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:

 

script%20filter%20queue%20options%201.pn

 

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

 

Cheers,

Andrew

Posted

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…

Posted

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

 

Sadly, we'll never be able to do process control with PHP. That's one of the standard components of PHP that Apple deems not to compile.

Posted

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 ;)

Posted

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

 

script%20filter%20queue%20options%203.pn

 

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.

Posted

This is fantastic. I'm currently working on workflow to search a remote API and return results. The script currently returns results on an incomplete query first, so being able to delay until the user has finished typing will greatly increase the effectiveness of this script.

  • 4 weeks later...
Posted

After all the excitement over Alfred Remote wore off (or dissipated enough to think clearly), I noticed this in the release notes of 2.6: "New Script Filter runtime behaviour options giving more control over when scripts are executed"

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