AutoIT: Enumerating all Windows

Here is a short script I wrote using AutoIT, which enumerates all of the windows, to the StdOut stream:

ConsoleWrite(“Enumerating windows”)
$AllWindows = WinList()
ConsoleWrite(“Found ” & UBound($AllWindows) & ” windows”)
for $i = 0 to UBound($AllWindows) – 1
ConsoleWrite(@lf & “Name: ” & $AllWindows[$i][0])
ConsoleWrite(@lf & “HWND: ” & $AllWindows[$i][1])
next
ConsoleWrite(@lf & “Completed listing windows.”)

Note: Please ensure that you check the “console” option when compiling this script for execution. If you do not check this box, there will be no StdOut stream created, which means you will get no output.