Retrieves a list of windows.
WinList ( ["title" [, "text"]] )
title | [optional] The title/hWnd/class of the windows to get the list. See Title special definition. |
text | [optional] The text of the windows to get the list. Default is an empty string. See Text special definition. |
If no title and text is given then all top-level windows are returned.
The array returned is two-dimensional and is made up as follows:
$aArray[0][0] = Number of windows returned
$aArray[1][0] = 1st window title
$aArray[1][1] = 1st window handle (HWND)
$aArray[2][0] = 2nd window title
$aArray[2][1] = 2nd window handle (HWND)
...
$aArray[n][0] = nth window title
$aArray[n][1] = nth window handle (HWND)
#include <MsgBoxConstants.au3>
Example()
Func Example()
; Retrieve a list of window handles.
Local $aList = WinList()
; Loop through the array displaying only visable windows with a title.
For $i = 1 To $aList[0][0]
If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then
MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1])
EndIf
Next
EndFunc ;==>Example
#include <Array.au3>
Example()
Func Example()
; Retrieve a list of window handles using a regular expression. The regular expression looks for titles that contain the word SciTE or Internet Explorer.
Local $aWinList = WinList("[REGEXPTITLE:(?i)(.*SciTE.*|.*Internet Explorer.*)]")
_ArrayDisplay($aWinList)
EndFunc ;==>Example