Core Function ControlSend

From Sputnik Wiki
Jump to: navigation, search
ControlSend ( <title>, <text>, <controlID>, <string> <flag> ) 

Contents

Description

Sends a string of characters to a control.

Parameters

Title

The title of the window to access.

Text

The text of the window to access.

controlID

The control to interact with.

string

String of characters to send to the control.

flag

Optional; Changes how "keys" is processed:

Return Value

Success: Returns 1.

Failure: Returns 0 if window/control is not found.

Remarks

ControlSend works in a similar way to SendKeys but it can send key strokes directly to a window, rather than just to the active window.

Example

ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window");


// 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", @MatchModeAdvanced);
// 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");
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox