Trigger a macro when exiting a specific sub window

It depends on the circumstances, I think. Its current incarnation, the single last window is stored as a variable. This means that you can have multiple instances respond to windows that appear separately, but if they appear at the same time, there would be conflicts where that variable gets overwritten.

One way to approach this might be to revisit this thread if you find that the macro isn't cutting it as part of your actual workflow. Then we can see if there's a neat way to adapt it.

1 Like

So I tried more contextual virtual buttons for the main cubase screen, and I could do it by combining your focus macro with the new one for the key editor. That's because the cubase main window never actually close, it just looses focus.

If I want to add the following condition :

going between the main window that contain "Cubase Pro Project" (and that is in the focus macro) and a window that contain : "Channel Settings : ||| Master" DOES NOT trigger any keystroke even if I go back and forth between those two windows many time

how would you do it ?

I requested on the elgato subreddit the ability to have a different shortcut for showing and hiding the virtual devices, it would just make everything so much more simple

Have you definitely spelled it correctly? You don't need to enter the whole thing, so try just "Channel Settings".

Should I do it in a third macro or add a condition on the existing focus macro

I'm not sure what you mean. A different Virtual SD profile?

Let's clarify. Do you mean that you want a particular hotkey for the main window and another for the Channel Settings window?

Without sitting next to you, looking at your screen, it's quite hard for me to understand what your end goal is.

We'll know that once your ultimate aim becomes clear. It may be that we need to change the macro entirely to accommodate new requirements.

Ok let’s recap

I want to switch between different virtual devices not profiles. That’s because on the current version of the stream deck software, you cannot show/hide specific profiles but only entire devices. But since you can create as many virtual devices as you want and give them custom layout, that’s even better.

I want each window to have specific devices shown, it would be easier if elgato allowed one shortcut to show and one shortcut to hide.

So in cubase I am testing this workflow on 3 windows, the main one start with « Cubase Pro Project » and it never close, it just go out of focus.
The second one is the Key editor, it can be closed, and sometimes I switch between different instruments parts which trigger a focus change but the key editor is still open (we solved this before)
The third window is more a pop-up that start with channel settings.

For the channel settings pop up window, what I would like is to prevent keyboard maestro from sending any of the previous shortcuts so that no virtual stream deck gets opened or closed when entering and exiting the channel settings.

Ah... but you have Keyboard Maestro!

SD Profile Switcher (Submacro).kmmacros (38 KB)

Macro screenshot

SD Profile Switcher (Example Caller).kmmacros (43 KB)

Macro screenshot

Let me see if I understand you now:

  • You always want the Virtual SD to be shown.
  • If the Key Editor window exists, you want its profile to show, and opening other windows shouldn't trigger anything.
  • If the Key Editor window does not exist, you want the profile associated with the main arrangement page to show.

Is that all correct?

If so, all you need to do is to replace your Hyperkey+W hotkey action with an SD profile caller, like the one above. When the Key Editor appears, switch to its profile; when it is closed, switch to your Arrangement profile.

The issue with using profiles is that you are stuck with one layout, by creating multiple devices you can customize the layout (rows x columns). This présent the advantage of integrating very precisely to an existing interface.

currently each device is limited to either 8 rows and 8 columns maximum. So lets say you want to fill an entire horizontal strip with virtual buttons, and you have the Space for 15 buttons, you can have a virtual device that is 1x8 right next to a second virtual device that is 1x7. It’s like you are using 2 different streamdecks but they look like one entity from the user perspective

When opening the Cubase Pro Project (main Window) I want the virtual device 1

When opening the key editor, I want the virtual device 1 to dissapear and the virtual device 2 to appear

When I am in the main window and I open the Channel settings window, I want to retain the virtual device 1

And lastly when I am in the mixer window, I want the virtual devices 1 and 2 to dissapear

I'm playing catchup here, so forgive me if I still haven't grasped it, but is this what you mean?

That's pretty cool! Similar to Keyboard Maestro's Palettes.

Anyway, back to the task at hand...

It sounds like you only ever want one device visible at a time. Is that right? In that case, I humbly suggest you do switch profiles rather than device. Why? I'll explain...

Maybe I'm off my game today but it's actually quite hard to get a macro together that does exactly what you want, as the only available SD hotkey is a toggle; i.e. the same hotkey to show the buttons and hide them.

As it's quite likely for the visibility state of each device to get out of sync (you end up with both or the wrong one if the toggle happens at the wrong time), this presents a bit of a problem. It's not made easier by the fact that AppleScript sees the floating button windows as window 1 or window 2 (if two are on-screen) and also doesn't seem able to close/dismiss them.

The only reliable way I can think to do it is by using found images of your device buttons to determine which device(s) are visible at any time. However, I make it a personal rule never to use found images unless I absolutely have to, so I'm wondering if @Nige_S can shake something loose here?

The aforementioned problem with syncing isn't an issue when switching profiles, as only one need ever be visible. If I understood correctly and you only want one profile to show at a time, this is the way I'd go.

The only differences I can see here are button count and position -- I don't know if either can be relied on.

Count me as another vote for Profile switching if only one VSD is on screen at a time. But found image could be restricted to the window area, which will make it more reliable if an image can be guaranteed.

Otherwise I'd probably either leave them both up, or if screen estate is at a premium I'd keystroke them into existence when required and let auto-hide get rid of them.

1 Like

You see inside they key editor alone, I want to use 8 differents layout to integrate with the gui. And we can't set custom layout per profile

Your 2 macros above (focus and window exist) actually get 80% of the job done since those are the 2 windows I use most of the time. They are already very good, the rest is just me neatpicking and it's better to wait for elgato to do separate shortcuts.

But you got me interested about keyboard maestro palettes, I didn't know it was a thing, I wonder if they can replace the streamdeck entirely

For what? Opening and closing? I don't think they will. Or for opening each device separately, which already exists?

Yes, I think so. Or you could create your own with Custom HTML prompts.

right now there is a toggle to open/close each device, I would like a shortcut for opening each device and another for closing each device.
I imagine that wouldn't be too much work to implement, I left the suggestion on the sub reddit, let's see if I get any response from elgato

I should dive into the documentation of palettes then. I don't know what a custom html prompts is unfortunately

I set my top left device with multi action buttons that trigger profile switch on multiple devices, it turn out nicely

1 Like

yeah, I think I was a bit premature in recommending them as an option earlier. You can create buttons that launch macros, but it's not so easy to reference the macro icons. If there was a way to do that, then we could make our own, infinitely customisable, virtual stream deck quite easily.