Is there a way to iterate over all open windows in Mac OS X?
===

When you unplug an external monitor with a higher resolution that your macbook from your laptop, the windows mostly retain their width, but their size gets clipped to the (smaller) height of the macbook screen. When you plug the monitor back in, their size remains frustratingly small.

My question is: is there any way that I can iterate over all open windows, save their size, and restore them once the monitor gets plugged in again?