vanclute Posted July 20, 2014 Share Posted July 20, 2014 I'm familiar with many other solutions for automation including PHP, AutoHotKey, Quickeys, and other similar macro/scripting languages. But I can't for the life of me wrap my head around some seemingly simple things in Alfred, despite having had Powerpack for a few years now. How can one perform simple conditional logic to detect for instance if a particular application has focus? I would like to perform an action only when a particular app has focus, but use the same hotkey that is already assigned to bring that app into focus. This is specifically because I want to show/hide an application in Windows under Parallels, but these apps don't support the show/hide functionality already available in Alfred. I want my hotkey to bring the app into focus, and minimize its window if that app is already in focus. I can't even seem to use the same hotkey more than once in a workflow because if it is already assigned to something, then you can't type it in another hotkey module since it will instead execute the hotkey. Appreciate any help with this... thanks! Link to comment
RodgerWW Posted July 20, 2014 Share Posted July 20, 2014 Not at all familiar with how Parallels works, but perhaps this toggle script on github MIGHT be of help. https://gist.github.com/jimeh/1013561 Link to comment
vanclute Posted July 21, 2014 Author Share Posted July 21, 2014 Ah interesting... might work, will give it a shot. Is it required to use an additional scripting language like AppleScript to do simple conditionals in Alfred? I had thought that it would have that capability built in given that it's supposed to be an automation tool (unless I misunderstand its intended applications). Thanks! Link to comment
vanclute Posted July 21, 2014 Author Share Posted July 21, 2014 Oh well... sounded good but alas the window will not hide. I tried miniturizing it as well... no go. Applescript can make the windows app gain focus, and can make it lose focus, but can't seem to hide/miniaturize the window at all. Link to comment
MuppetGate Posted July 26, 2014 Share Posted July 26, 2014 Ah interesting... might work, will give it a shot. Is it required to use an additional scripting language like AppleScript to do simple conditionals in Alfred? I had thought that it would have that capability built in given that it's supposed to be an automation tool (unless I misunderstand its intended applications). Thanks! I did put in a feature request for some sort of conditional workflow module a couple of years ago. Hope it comes along some day. Link to comment
rice.shawn Posted August 1, 2014 Share Posted August 1, 2014 The setup with Parallels is a bit problematic (if I'm understanding correctly). Applescript is the bridge that let's you interact well (enough) with the OS X GUI, so it can easily tell you which app has focus, and then it can do a few more things like that, but I don't think it can do so well trying to communicate with an operating system in another app (Windows in Parallels). It would entirely depend on what sort of AppleScript dictionary Parallels provides. The other problem is that (and I'm not sure about this) Parallels might be stealing the hotkeys when it has focus so that it can send those hotkeys through to Windows. If you were trying to do this sort of setup with a regular application on OS X, then it would be very simple, but you're mixing operating systems. 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