Actually, scratch that question—ChatGPT and I figured out how to get the window list from any application :). So, here's my solution in action...
Animated GIF hides here

The first version I came up with was really ugly, as it tried to move the mouse around the screen. This version is much better, and has some notable features:
- It will work with any number of windows. However many are open in the frontmost app when the macro is activated is how many it will attempt to click in.
- As seen in the GIF, the windows don't need to be the same size, and don't need to be aligned (and don't even need to be on the same display).
Here's the macro:
Download Macro(s): Click in all four windows.kmmacros (46 KB)
Macro screenshot
Macro notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System information
- macOS 14.4.1
- Keyboard Maestro v11.0.2
Briefly, here's how it works. You invoke in the window you want it to begin in (and that window must be active). Position the mouse where you want to click, then invoke the macro (assigned to Shift-Control-P, but change it to whatever you need).
The macro then gets the name of the active app, and generates a list of open windows in that app (and removes the active window from the list). For the current window, it saves the mouse's location, then calculates how far that is from the upper left corner of the window. Finally, it clicks the mouse—that is, once you disable demo mode. In demo mode, it simply highlights the mouse location. To disable demo mode, disable the first action in the macro.
Next, the macro cycles through the window list. It activates each window in the list, pauses to let it become active, then moves the mouse to the same relative location as in the first window, and clicks.
Repeat until the loop is done, and that's that. As noted, this should work for any number of windows of any size, in any location. The only requirement is that the same relative location from the top left of the window must be visible in all windows.
You may have to adjust the two pause actions in the macro, depending on the speed of the Mac and/or the app in question.
Let me know how this works for you; I recommend first leaving it in demo mode, just in case the clicks don't go where you think they'll go.
-rob.