humdash Posted February 15, 2016 Posted February 15, 2016 Hello everyone, I'm creating a small snippet that retrieves data for a given domain and prints out a few options based on the domain availability. Currently I got it working with no issues using a keyword and script filter prints out XML items based on the availability. No issue so far. But it's feels pretty unnatural to use the keyword (I'm using 'whose' which is the name of the workflow), so I'd like to make trigger the domain when the query matches a domain structure. Currently there's already a script with opens the URL (it's called openurlsearch), and I'd like to have my workflow appear like that too. Is it possible? I know that I could try to use the fallback solution, but if you type a domain Alfred will only show the Open URL workflow, so people would have to disable the web search from settings and things would be just too complicated. Any ideas to help me solve this out? Thanks!
rice.shawn Posted February 18, 2016 Posted February 18, 2016 You can't run a script filter without a keyword. Andrew wrote it this way to ensure performance; otherwise, the script would run on every key press, slowing down Alfred as it waited for the script to finish. If you installed a few workflows that ran like that, then it would slow everything down. However, there is a hack. You could set the keyword to 'http://' or to 'www.' or something like that. If you wanted it closer, then you could set the keyword to either 'h' or 'w'. If you want to query domains that might start with any letter, then you could set 26 keywords (one for each letter of the alphabet) that all run the same script filter. If you do it that way, then there are three things to remember: (1) make sure that there is no space needed to run the script (checkbox in the keyword settings) (2) remember that the first letter won't be in {query}, so for each script filter, make sure you prepend it to the query. (3) exit early and often so that you don't slow Alfred down immensely. humdash 1
humdash Posted March 15, 2016 Author Posted March 15, 2016 Thanks for your reply and tips Shawn! Quite a bit late but thanks I decided to make backslash the keyword, followed by the domain, so it's still pretty fast to type. It doesn't feel sluggish at all also, I'll publish it soon so others can use it too! Grazie!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now