Added in 2.6.0:
acGetAllWindows([0 or 1]) action which populates a global table (created in C++, not by you) named sp_all_windows. This allows you to loop through the table and do whatever you'd like. For example, you want an action which finds all windows of a certain title/class/EXE and does something with them. Passing 1 only returns top-level desktop windows (usually what you'll want to do), passing 0 returns ALL window handles (a lot); for example, I had 5 programs open, passing 1 returns 5 results consisting of just the main window handles for each app. Passing 0 returned a table of 380 handles! Remember, each button, text box, etc. is considered a window and gets a handle. I'm certain there will be apps which use weird hidden windows as the owner and might be incorrectly represented in a top-level request, but that should be very rare.
Example script (only gets top-level windows):acGetAllWindows(1)
for num, handle in pairs(sp_all_windows) do
local sMsg = "EXE: "..acGetExecutableName(handle,0,0)
sMsg = sMsg.."\nClass: "..acGetClassName(handle,0,0)
sMsg = sMsg.."\nTitle: "..acGetWindowTitle(handle,0,0)
acMessageBox(sMsg,"Index: "..num,nil)
end
Note that this function only considers desktop top-level windows, not Win 8 Metro apps; you'd need to pass 0 and work through that yourself...not that there's much use I can think of for this functionality in dealing with Metro apps.