Jump to content

Query is to {query} as keyword is to {???}


Recommended Posts

This must have been asked before but my Google Fu is weak today. 

 

I want to know which keyword was typed. Is there a way to determine that from the script?

 

I guess I could have an intermediate script between my multiple keywords. I'm sure that's what I'll end up with but I'm still curious to know.

Link to comment

What I usually do is keep all the code in an external script that accepts command line options, e.g. --list or --config or --open-help or whatever.

Then each keyword is linked to a "dumb" Run Script that calls the external script via bash with the appropriate command, e.g.: 

/usr/bin/python myscript.py --search "{query}"

or 

/usr/bin/python myscript.py --config

It's still bit clunky, but that's probably the best way to do it given the limits of Alfred's workflow execution model. It's also more explicit than performing some keyword-based magic in your script.

Edited by deanishe
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...