Execute command when non-focused Window Title changes

Hello,

Use case: I use a DAW (Steinberg Nuendo) with multiple windows' open at the same time:

  • The Project Window: contains all the tracks, instruments and audio clips. The instrument/midi tracks hosts midi "parts" containing the actual MIDI data.
  • The Key Editor: when selecting a MIDI part in the Project Window, the MIDI data will apear here for editing.

Steinberg's software is based on an extremely old code base, ported from Windows in a non-optimal way and is therefore poorly written when it comes to window management and worklow. Thank God for KM where I can "duct tape" their (lack of) functions to fit a proper workflow.

They have overlooked an essential feature: the view of the Key Editor will not zoom in/out for the content to fit automatically. So every time I select a midi part, either it's zoomed in so much that all content is not visible, or it zoomed out so you can't overlook it properly.

There is a command in Nuendo "Zoom to content" that I've now had KM automatically execute whenever I focus the Key Editor. This is "half-good", but optimal would be that every time I select a MIDI part in the project window, it would automatically focus the Key Editor, execute the "Zoom to Content", then switch back to the Project Window.

The Key Editor window can be accessed (it is in several of my macros), and it changes title based on the selected MIDI part to "Key Editor: [part name]".

So here's the question: is it possible to have KM sense the title change of a non-focused window in an application? This way I'd be able to – every time selecting a new part – have KM quickly focus the Key Editor, run "Zoom to content" and switch back to the Project Window. Or if it's possible to send the command to a non-focused window.

Any ideas?

Best,
Andreas

KM doesn't get told when a background window's title changes, so you can't use that as a trigger. But KM can ask. So you could have a macro that triggers when Nuendo activates and loops while Nuendo is the frontmost app, testing for a window name change.

Totally untested, but something like (using TextEdit as a placeholder for Nuendo, so change to suit):

Edit: Updated to start with a "Pause Until" to wait for "Key Editor" window to have a name.

Test Background Window Title.kmmacros (7.8 KB)

Image

1 Like

Another option might be to trigger a macro on mouse click if that's how you tend to select midi regions.

Zoom Key Editor on Selection Change .kmmacros (23 KB)

Macro screenshot

Recapture your own mouse click as the trigger, replace the green action with your zoom steps and place the macro in a Nuendo-specific group. If you use alternative region selection methods (arrow keys, for example), this can be easily modified to include them as triggers.