Jump to content

Stop previous program execution


Recommended Posts

Hi All! New to the forum and developing Alfred workflows.

 

I'm creating a workflow and running into a couple problems.

 

The workflow I'm creating makes HTTP requests. One problem I'm having is that multiple requests are being made as the user is typing. For example, if a user types "Hello" a request is made for "h" "he" ... "helllo". Is there anyway to only  run my program after the user has stopped typing?

 

Another question I have is: what is the best implementation for "fetching results"

 

For example, the user has entered "Hello" and now writes "Hello Goodbye."  What is the best way to display a "fetching results" (instead of showing results from "hello" in Alfred)?

 

Thanks for the help in advance and let me know how I can improve my posts / content above. 

Link to comment

Double-click on your Script Filter and adjust the Run Behaviour.
 
The default behaviour is to try to run your script after every character.
 
For anything dealing with remote data, I use "Wait until previous script finishes" for Queue Mode and "Automatic delay after last character typed" for Queue Delay.
 

Another question I have is: what is the best implementation for "fetching results"

For example, the user has entered "Hello" and now writes "Hello Goodbye."  What is the best way to display a "fetching results" (instead of showing results from "hello" in Alfred)?

 
The above Run Behaviour is about the closest you can get without adding extra logic to your script. It won't call your script till the user pauses typing.

 

Because Alfred might try to call your script several times a second, the best thing you can do in terms of UX (if it makes sense for your workflow) is to cache data from the web locally for at least a few seconds.

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