sudopeople Posted June 20, 2014 Share Posted June 20, 2014 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
sudopeople Posted June 20, 2014 Author Share Posted June 20, 2014 Oh wait, I can't make an intermediate script, can I? I guess I'd have to make two scripts that do almost the same thing except have the keyword that calls them hard coded Link to comment
sudopeople Posted June 20, 2014 Author Share Posted June 20, 2014 My solution is to have one script per keyword that has the keyword hard coded into it, that then calls a second script from within it...since I can't chain scripts Keyword -> Script -> Script -> Output. I still wonder if there's another way. Link to comment
deanishe Posted June 22, 2014 Share Posted June 22, 2014 (edited) 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 June 22, 2014 by deanishe Link to comment
sudopeople Posted June 25, 2014 Author Share Posted June 25, 2014 That's pretty much what I've done in essence. Thanks for your reply. Link to comment
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