The WIndowNames function will return a list of all open, unhidden, windows.
Depending on what the windows show, you might get better performance overall if you hide the windows instead of closing them.
You can use a pile to pile up or depilate the list of the windows and the command of opening.
Set +1 when opening a new window and -1 when closing a window.
terms for which I don't equate with "windows":
pile up or depilate
1 of 1 people found this helpful
If Google had made a better translator, the right remarks would have been used.
But I think that everyone will have understood what my bad English wanted to say.
In case of, I use a list where I store the number, the identification or the name of window as they are created. When I close a window, its name is wipped out of the list and the order of the opening is the same that the order of the list.
Using such a list, you can read the list and with each open window, close it if it is not the current layout or the session layout.
To store the number of opened windows, I use a global storage so it can be used everywhere in the solution.
I use also a script to write to the list or wipe out of the list the identification of opened or closed windows.
Number of registered windows in the list is increased or decreased in same way.
go ahead and use French replies, bertrand! It makes those of us a bit rusty get some refreshers.