ProTools - Detect Frontmost Plugin in Focus and pass Name to variable ! Solution?

I have an apple script, that is able to switch the little plus-minus button of a Plugin.

The problem is, it works only with the name of the Plugin.
I would like to apply it to the frontmost plugin window with the target button activated.

I know how to find the red target button - via an image. But i have no idea how to get the name of the plugin.

Anyone has an idea for an approach ?


I'm slightly crippled in attempting to help by being away from my mac for the next few days and being a Logic user. However..

You may be use every window whose name does not contain "Edit: " and name does not contain "Mix: " in your script to isolate the plugin window.

Or... If the button is always in the same position relative to the plugin window, you could cycle application windows until the front window title does not contain either of the above strings and then click relative to the front window's corner.

P.S. current view: