Core Function WinGetHandle
From Sputnik Wiki
WinGetHandle ( <title>, <text> )
Contents |
Description
Retrieves the internal handle of a window.
Parameters
Title
The title of the window.
Text
Optional; The text of the window to read.
Return Value
Success: The window handle value.
Failure: @PTRZero.
Remarks
This function is for use with the advanced WinTitleMatchMode options that allow you to use classnames and handles to specify windows rather than "title" and "text".
Once you have obtained the handle you can access the required window even if its title changes.
See "WinTitleMatchMode" in Opt
Example
// Identify the Notepad window that contains the text "this one" and get a handle to it // Change into the WinTitleMatchMode that supports classnames and handles Opt("WinTitleMatchMode", 4); // Get the handle of a notepad window that contains "this one" $handle = WinGetHandle("[class=Notepad]", "this one"); If ( $handle ) { // Send some text directly to this window's edit control ControlSend($handle, "", "Edit1", "AbCdE"); } Else { MsgBox("Could not find the correct window"); }