Core Function WinList
From Sputnik Wiki
(Difference between revisions)
(→Example) |
m (1 revision) |
||
(4 intermediate revisions by one user not shown) | |||
Line 19: | Line 19: | ||
=== Return Value === | === Return Value === | ||
− | Success: Returns an array of matching | + | Success: Returns an array of matching windows. |
− | Failure: Returns an empty array. | + | Failure: Returns an empty array. |
=== Remarks === | === Remarks === | ||
Line 34: | Line 34: | ||
Opt( "WinDetectNoTitle", 0 ); // Do not check windows that have no title at all | Opt( "WinDetectNoTitle", 0 ); // Do not check windows that have no title at all | ||
Opt( "WinWaitDelay", 0 ); | Opt( "WinWaitDelay", 0 ); | ||
− | + | Opt( "WinSearchChildren", 0 ); // Only search top-level windows | |
+ | |||
$i = 0; | $i = 0; | ||
foreach ( WinList() as $pList ) | foreach ( WinList() as $pList ) | ||
{ | { | ||
− | List( $Title, $HWND ) = $pList; | + | List( $Title, $Text, $Class, $HWND ) = $pList; |
If( IsWindowVisible($HWND) ) | If( IsWindowVisible($HWND) ) | ||
− | println("Title '$Title' HWND '$HWND'"); | + | println("Title '$Title' Text '$Text' Class '$Class' HWND '$HWND'"); |
} | } | ||
− | + | ||
Function IsWindowVisible($HWND) | Function IsWindowVisible($HWND) | ||
{ | { |
Latest revision as of 12:37, 14 June 2015
WinList ( <title>, <text> )
Contents |
Description
Retrieves a list of windows.
Parameters
Title
The title of the window.
Text
Optional; The text of the window to read.
Return Value
Success: Returns an array of matching windows.
Failure: Returns an empty array.
Remarks
None.
See "WinTitleMatchMode" in Opt
Example
Opt( "WinDetectNoTitle", 0 ); // Do not check windows that have no title at all Opt( "WinWaitDelay", 0 ); Opt( "WinSearchChildren", 0 ); // Only search top-level windows $i = 0; foreach ( WinList() as $pList ) { List( $Title, $Text, $Class, $HWND ) = $pList; If( IsWindowVisible($HWND) ) println("Title '$Title' Text '$Text' Class '$Class' HWND '$HWND'"); } Function IsWindowVisible($HWND) { If ( WinGetState($HWND) & 2 ) Return 1; Else Return 0; }