Close All Windows


I am trying to write an action to close all open windows. I see there is an option from the windows menu to close all windows which closes all windows that are open and have the closable property enabled but I would like to be able to have a button to do this. I have tried using windows = fpmi.gui.getOpenedWindows() but I get an error when I try to use fpmi.nav.closeWindow(windows). Do I need to use a for loop to go through each of the screens returned from the getOpenedWindows() and then use fpmi.nav.closeWindow to close the window

Any help much appreciated


Yes, that is exactly what you want to do.

for window in fpmi.gui.getOpenedWindows(): fpmi.nav.closeWindow(window)


That worked fine