Hi,
I use Studio One to create and mix music. If that program is running I would like to automatically return to it and have it in focus as soon as I close or minimize another app.
Use case: When using Studio One I may look up info in a browser or look for files in finder etc. When I close or minimize those apps/windows I want to be able to go back to controlling Studio One with hotkeys without clicking on it's window to give it focus.
Can this be done? If possible with the apps that (upon closing) qualify as a trigger limited to a few specified ones.
To trigger a macro when an application deactivates, use the Application trigger, and set it to when any application deactivates if you want it to return to Studio One when any app deactivates (I don’t recommend this), or set it to when specific applications deactivate. If you want it to fully execute only when Studio One is running, your first action should be some sort of verification that the app is running, that cancels the macro if it isn’t. See the Redirect Control Flow (specifically, the Cancel Just This Macro portion) and Assert actions for more info.
@cdthomer I works partly but not quite with the desired result yet.
The trigger works for closing another app but not for minimizing it. Some apps need to be running in the background because they deal with the routing of signals for example. So these apps I don't close but minimize and was hoping to have that function as a trigger as well. I can see that might be difficult.
Studio One is being activated (it's menu appears at the top), but the main window still needs a click in order to receive hot key commands. This might be a Studio One particularity. Maybe this can only be achieved by making a mouse click part of the macro. That shouldn't be too hard but isn't the most elegant solution.
If you have any suggestions I would love to hear them. Thanks for your help.
You may not close them, but can you hide them and have them still work properly? I have found a lot of folks use different terms interchangeably... such as “maximize” and “zoom”... which are two different things in macOS, as well as “close” when they really mean “hide”... since those are also two different things. So if the app(s) in question can still run properly while being hidden, then that opens up more options.
Sounds like it’s being activated, but not brought to the front. Did you check the two boxes in the activate a specific application action like I showed in the screenshot? If not, try that. If you did, then try adding a Manipulate a Window action, and select “Bring to front” as the option.
The activation works now. Excellent! The only missing link is the macro being triggered when a specified app is minimized. When I say minimize I mean pressing the yellow/orange button in the top left of the app's window. Is that a state change that can be detected?
You are right. Minimizing a window with the yellow dot keeps the app active, so my remark about minimizing the app wasn't worded correctly. I minimize it's active window and want that to be a trigger.
I'm not quite clear however about your suggestion to use Focussed Window Trigger for this. Using the debugger I notice no trigger activity for each of the different options this trigger has when I minimize a window. As soon as I close a window the trigger fires, but not when I minimize it.
Since I have limited experience with this trigger, I looked at it more closely and it appears that minimizing a window does not work to trigger it. See the example test macro below. So to sum it up, I’m not sure if you would be able to detect a window minimizing and trigger a macro that way.
Yes, that opens the door to more possibilities. The only drawback is that I wanted to create this macro to deal with my own built in habit of closing/minimizing an app and expecting the previous app that is then back at the front to be automatically active. This habit may stem from having been a Windows user for over 30 years (can't check if it actually works that way on PC). Basically I was hoping for a solution I didn't have to think about.
Your approach is obviously still better than no macro at all. Thanks.