OliverJAsh Posted January 18, 2013 Posted January 18, 2013 Potential duplicate: http://www.alfredforum.com/index.php?/topic/133-is-there-a-way-to-get-the-keyword-and-not-just-the-arguments/ I have multiple keywords going to a single AppleScript. Is there any way I can get the AppleScript to read which keyword has been used? I have an AppleScript that I wanted to do things dynamically depending on the keyword that was entered. Preferably, I would like to do this without using arguments, as I only want to have to type in one keyword to run the script.
ClintonStrong Posted January 18, 2013 Posted January 18, 2013 As far as I know it's not possible to read the keyword. However, you could have each keyword run a bash script that sends a keyword to an applescript: osascript scriptname.applescript keyword You'd then just open the workflow folder and create the applescript file there. To get it to read the keyword, you'd use something like this: on run argv set theKeyword to item 1 of argv -- your script here end run It's not as elegant as I'd like, but hopefully it'll work for you. OliverJAsh 1
OliverJAsh Posted January 18, 2013 Author Posted January 18, 2013 Awesome! I'm probably being stupid but when I run `osascript test.applescript keyword` from terminal, I get: test.applescript:53:78: execution error: No user interaction allowed. (-1713)
ClintonStrong Posted January 18, 2013 Posted January 18, 2013 You might need to make a few adjustments to get it to work with osascript. Feel free to message me with the script if you need any help.
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