Florian Posted October 19, 2013 Posted October 19, 2013 Hey guys, I've been trying to make a simple workflow that would automatically give the focus to another textfield so that the UX would look like that: I type my ⌘+space (alfred shortcut), then I type the keyword for my workflow, say "menu search", then space (or autocomplete to get the extra space after the keyword), and then when I start typing my query, I'm already in the appropriate textfield (shortcat, help search menu, spotlight...) and not in alfred anymore. I think that theoretically, the workflow would be pretty simple. Just this should work (I get my shortcat from space+ctrl): tell application "System Events" keystroke space using control down end tell If you had this osascript in a script filter with space required and argument optional, what I'm describing should work. But it doesn't. any idea? If it's blocked by andrew, why? here is a link to my "test" workflow: http://dl.getdropbox.com/u/14050630/test.alfredworkflow
jdfwarrior Posted October 29, 2013 Posted October 29, 2013 Hey guys, I've been trying to make a simple workflow that would automatically give the focus to another textfield so that the UX would look like that: I type my ⌘+space (alfred shortcut), then I type the keyword for my workflow, say "menu search", then space (or autocomplete to get the extra space after the keyword), and then when I start typing my query, I'm already in the appropriate textfield (shortcat, help search menu, spotlight...) and not in alfred anymore. I think that theoretically, the workflow would be pretty simple. Just this should work (I get my shortcat from space+ctrl): tell application "System Events" keystroke space using control down end tell If you had this osascript in a script filter with space required and argument optional, what I'm describing should work. But it doesn't. any idea? If it's blocked by andrew, why? here is a link to my "test" workflow: http://dl.getdropbox.com/u/14050630/test.alfredworkflow This should work. I can use AppleScript to display shortcat. If I need to do it for a specific window though, I did have to add a delay in the script to get it to work properly. For instance, I wanted to test it by swapping to Safari and then calling Shortcat. To do this, I couldn't just... tell application "Safari" to activate tell application "System Events" to keystroke space using option down I had to.. tell application "Safari" to activate delay .5 tell application "System Events" to keystroke space using option down Perhaps you need a delay for something? Not sure what your code looks like or is doing so.. I'm not sure right off. The delay could probably be decreased also. I just stuck a number in there to test this.
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