Trevor Sullivan's Tech Room

Minding the gap between administration and development

AutoIT: Enumerating all Windows

Posted by Trevor Sullivan on 2010/04/09

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])
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.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: