I am working on an application that moves windows of third party applications around on the screen.
To get an overview of all currently open windows, I use
There is a private function for obtaining CG window number for a given AX object for window: _AXUIElementGetWindow
.
More details in SO discussion Uniquely identify active window on OS X
It looks like there is no public API to do the task with 100% probability. Identifying windows by title and frame (as described in answer above) will works in 99.9% of cases.