Paul's suggestion is the simplest solution for most scenarios. As the documentation shows, simply select the "All Windows" option and perform the search:
However, if it's something complicated that requires scripting, the following code will do the work for you:
for name in system.gui.getWindowNames():
system.nav.openWindow(name)
components = system.gui.getWindow(name).getRootContainer().getComponents()
for component in components:
#identify your component, and do the necessary work here
system.nav.closeWindow(name)
Here is a more advanced example that effectively illustrates such a scenario: