Execute script upon swapping windows

I have a tab strip that I am using to swap between main windows. I want to execute a script to open a docked window based on which main windows I’m swapping to.

internalFrameOpened and visionWindowOpened will both only execute the script once when the client is opened. If I swap to another window and swap back, the script won’t execute.

internalFrameActivated requires me to click the main window to give it focus before it executes the script, but I would like the script to execute immediately when I swap windows.

Is there a good way of doing this?

Would a property change script tied to selected tab property of tab strip do what you’re looking for?

I tried this to close the current main window and open a window based on the selected tab property.

It works but it loads slower than swapping windows. Thanks for the help.

I may have misunderstood, but was thinking you’d continue swapping the main windows and use the script to update docked windows. It will be slower to open a window that isn’t already open. If you want instant, you could have the docked windows all open and adjust width (or height, depending where they are docked) to zero to hide all but the one you want to show at any given time.