Test for specific layout in another window
What would be the most straightforward way to test if any open window (assuming there are more than one) is currently on a certain layout?
There is a WindowNames function that returns a list of the names of all open windows. A script could loop through that list in order to select each window in turn and use Get ( LayoutName ) to check for that specific layout. But this will cause each window to briefly pop to the front unless the window is a floating document window or modal dialog window.
Set Variable [ $WindowList ; WindowNames ]
Set Variable [$K ; value: $K + 1 ]
Exit Loop If [ $K > ValueCount ( $WindowList ) ]
Select Window [ GetValue ( $WindowList ; $K ) ]
IF [ Get(LayoutName ) = "NameofYourLayoutHere" ]
Set Variable [$Window ; value: GetValue ( $WindowList ; $K ) ]
Exit Loop If [True]
Your question needs some clarification. Every window has a layout. Do you want to know how many windows are opened? Or do you want to know if a layout is opened on more then one window?
Thanks for the response. I'm trying to see if if any of my open windows is currently showing a specific layout. I'm specifically trying to solve for a situation where I have two windows open, and IF the non-active one is on a certain layout, I want the script to do one thing, but if it's on any other layout, the script should just exit. (The reason I want to account for any number of open windows is that a user could potentially open multiple windows, even though my UI tries to prevent that from happening).
Retrieving data ...