JimmyTheSaint Posted December 6, 2017 Share Posted December 6, 2017 In the other thread, @deanishe wrote: To run an .scpt file: /usr/bin/osascript /path/to/applescript.scpt or to run AppleScript: /usr/bin/osascript -e 'tell application "Alfred 3" to ...' My script consists of this one "tell" statement: tell application "Alfred 3" to run trigger "SafariTabs-ext" in workflow "com.my.SearchTabs" The script works fine when I trigger it from a key_code using this piece of code in my Karabiner-Elements json file: "to": [ { "shell_command": "/usr/bin/osascript ~/Documents/SafariTabs-my.scpt" } Since the scripts I intend to write will all be one-liners, I would rather put the "tell" statement inside the json file rather than call a script. What's the proper K-E json syntax to make that "tell" statement part of the shell_command? I would think that I have to escape the spaces and double quotation marks, but I haven't been able to get it right. Link to comment
deanishe Posted December 6, 2017 Share Posted December 6, 2017 (edited) 5 hours ago, JimmyTheSaint said: I have to escape the spaces and double quotation marks Just the quotation marks. This should be correct: "shell_command": "/usr/bin/osascript -e 'tell application \"Alfred 3\" to run trigger \"SafariTabs-ext\" in workflow \"com.my.SearchTabs\"'" Edited December 6, 2017 by deanishe Add -e to command JimmyTheSaint and sin 2 Link to comment
JimmyTheSaint Posted December 6, 2017 Author Share Posted December 6, 2017 yes, that worked. I thought I'd already tried all combinations of escaping stuff. 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