Bring One Application Window with a Specific Title to the Front?

Hey Neil,

You can do that with AppleScript:

--------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2021/07/15 19:51
# dMod: 2021/07/15 19:51 
# Appl: Finder, System Events
# Task: Bring the Window Whose Name Does NOT Contain “Mixer” Or “Tracks” to the Front.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @System_Events, @Window, @Front
--------------------------------------------------------

tell application "System Events"
   tell application process "Logic Pro"
      set winList to windows whose name does not contain "mixer" and name does not contain "tracks"
      if length of winList = 1 then
         set winRef to item 1 of winList
         tell winRef
            perform action "AXRaise"
         end tell
      end if
   end tell
end tell

--------------------------------------------------------

It's possible with a Keyboard Maestro native action too, but you need a sophisticated understanding of how to use a negative-lookahead regular expression.

Bring Window Whose Name Does NOT Contain “Mixer” or “Tracks” to Front v1.00.kmmacros (5.7 KB)

On the other hand you could brute force it by getting a list of all the windows Keyboard Maestro can see in the given app, parse the list, and choose the window title NOT containing the undesired strings.

(This method would be more available to the average user.)

List Windows Keyboard Maestro Can See v1.1

-Chris

2 Likes