WinList
From AutoIt Wiki
Syntax
WinList ("title" , "text")
Description
Provides a list of window titles and handles.
Returned Value
Returns an array of window titles and handles based of name or text.
This example will look for the text "Windows Internet Explorer" within the title and return a list of all windows.
; Open 1 or more instances of IE
$Client=WinList("","Windows Internet Explorer") ; Title bar contains this text, case sensitive
ConsoleWrite("Debug: " & $Client[0][0] & @LF ) ; Count of windows returned
For $i = 1 to $Client[0][0] ; do for each copy
ConsoleWrite("Debug " & $i & ",0 : " & $Client[$i][0] & @LF ) ; window title
ConsoleWrite("Debug " & $i & ",1 : " & $Client[$i][1] & @LF ) ; window handle
Next
This sample looks the first characters within the title, great is looking for a specific txt document opened with Notepad.
; Open 1 or more instances of Calculator
$Client=WinList("Calc","") ; Title bar Starts with or exactly matches, case sensitive
ConsoleWrite("Debug: " & $Client[0][0] & @LF ) ; How many copies are running
For $i = 1 to $Client[0][0] ; do for each copy
ConsoleWrite("Debug " & $i & ",0 : " & $Client[$i][0] & @LF ) ; window title
ConsoleWrite("Debug " & $i & ",1 : " & $Client[$i][1] & @LF ) ; window handle
Next
Returns a list of all windows.
; Use SciTE to execute this sample
$Client=WinList() ; All Process
ConsoleWrite("Debug: " & $Client[0][0] & @LF ) ; How many copies are running
For $i = 1 to $Client[0][0] ; do for each copy
ConsoleWrite("Debug " & $i & ",0 : " & $Client[$i][0] & @LF ) ; window title
ConsoleWrite("Debug " & $i & ",1 : " & $Client[$i][1] & @LF ) ; window handle
Next
Use SciTE to execute these samples