Trying to make two states for one key on Premiere Pro

Hello everybody!
I’m trying to set the Escape key to do two actions in Premiere Pro:

  • when using the software without any small window (or popup window) open, I want it to trigger a keyboard shortcut (toggle source/program focus).
  • when there is a window open (preferences or any other popup window), I want the escape key to do what it does by default: cancel/close the window.

KM does not recognize any buttons and does not recognize the screenshot of the cancel button, so I’m looking for a variable or something like: once there is a window open, use the regular escape function.

Do you think it’s possible to do that?
TIA.

Cheers!
Max

The accessibility API, via AppleScript, could potentially determine which windows are open.

Other than that, maybe a Found Image condition could detect the window.

Thanks. Found image condition is not working unfortunately.
As for AppleScript, I just don’t know how that works!

Me either, but someone else on the forum probably does if you ask that specific question.

Thanks. I asked Claude.ai and the solution he found is quite “straightforward”:

But I’ll need to add a lot more windows titles, which is not the fastest solution.