How to make the "frontmost" app always active, before triggering any of its macros?

Hello all,
perhaps a simple question, but I'm stuck on it anyway.

The question is about Pro Tools in this case, but every app may be potentially involved.
I haven't found a similar question on the forum, should I be wrong please let me know where to search for.

Occasionally, I have Pro Tools in "frontmost" position but not "active", for example when I switch from PT to Finder, then back to PT, before clicking on any PT windows of course.
In this case, the macros in the related Pro Tools macro group will not trigger (99% of them have hotkey triggers).

When typing one of those hotkeys, is there a way to "prioritize" a simple Applescript like
"activate (path to frontmost application as text)",
so that Pro Tools activates (when frontmost) and the related macro gets triggered correctly?

I could make all the PT macros "global", activate the frontmost application by the above Applescript and determine the destination macro depending on trigger + frontmost app, but I'm sure there's a quicker and more elegant way to do that, considering I have about 150 macros just for PT... :cold_face:

I'm on a Mac Studio M1 Max, but nothing different from Intel, if I remember correctly.

Thank you!
Jan

Edit --> at the moment the Pro Tools macro group settings are the following
(I made two copies of Pro Tools.app, one running under Rosetta and the other running natively):

xx

I don't understand how that can be... Can we check whether PT really is active when you think it is..?

Create a (global, not app-specific) macro to bring up an alert. Use the "this application" trigger and set it to Pro Tools and "activates". When you toggle between Finder and PT, is the alert shown?

If you see the alert, then perhaps it is the window that is not active..?

Thank you @kevinb for your answer,
when I switch from Pro Tools to Finder with Cmd+Tab, sometimes I close all Finder windows with a macro (or just minimize the front Finder window) once finished, without hitting Cmd+Tab again to get back to Pro Tools.
The result is, Pro Tools is visible and on the front, but the Finder bar is still active. This happens quite often in my case.
I guess the only way is unlink the macro group from Pro Tools, add the AppleScript below where needed and check if PT is running.

Thank you!
Jan

AS

1 Like

It sounds like you are trying to fight a fundamental way that the Mac works.

Minimising or closing all Finder windows on a Mac does not stop Finder being frontmost (even if you can see windows of another app).

If you are often switching from Finder to ProTools and want to close all Finder Windows when you make the switch you could make a Macro that does those two things (closes all Finder Windows and switches to ProTools) make that Macro active in Finder and give it a hotkey.

3 Likes

Or simply cmd-alt-W followed by cmd-H may do what you need, @freewind1974 ..?

1 Like

Thank you for your help, @Zabobon and @kevinb !!
I think I got a clearer idea on how to proceed:

IF Pro Tools is running, AND a window with title containing ("Edit:" OR "Mix:") exists:

  1. Bring to front/activate Pro Tools;
  2. Search for the destination macro to launch, in the PT group only, filtering by the pressed hotkey;
  3. Execute that macro (by name? UUID?).
    I'm not thinking of "hotkey" because of course it might be associated with more apps than just PT.

I'm not bothered with other apps (they will follow the usual app-specific group logic), but working all day with Pro Tools, as ancient as it is, I'm trying all I can to get as fast as possible.

Point 1 is easy, how about the others?
Thanks!
Jan

Unless there are other factors that you have not yet told us about, it still seems that the problem here is simply that you are not activating Pro Tools. Closing windows in the Finder is irrelevant, as @Zabobon explained. Switch to the app if you want the app's app-specific macros to work.

Let's look at your original question again:

You do now understand that, as explained by @Zabobon, Pro Tools was not, in fact, active when you thought it was, yes?

When Pro Tools really is active, the macros in your macro group for Pro Tools will be enabled – I say that on the basis that your screenshot shows that you have set that macro group to be available when Pro Tools is active.

Just make sure that Pro Tools is active - actually switch to it so that it is the foreground app, with its menu bar clearly visible - and your macros should work (at least to the extent that they are enabled!). There should be no need for complex solutions, as far as I can see.

Please proceed on that basis and let us know how you get on.

1 Like