ZennoLab Assemblies Documentation
SendText(Int32,String) Method
Example 

Type: System.Int32

The handle of the window.

Type: System.String

The text for send.

Sends a text to the window with specified handle.
Syntax
public static string SendText( 
   int handle,
   string text
)

Parameters

handle

Type: System.Int32

The handle of the window.

text

Type: System.String

The text for send.

Return Value

Type: System.String

The answer with information about the success of the current command's execution. If current command was successful then this answer is "ok"; otherwise message describing the error.

Example
The following code example demonstrates uses of the SendText method.
// find the html element
HtmlElement he = instance.ActiveTab.FindElementByTag("input:text", 0);
// check the element
if (!he.IsVoid)
{
    // focus on this element
    he.Focus();
    // send text
    string result = Emulator.SendText(instance.ActiveTab.Handle, "Simple text"); 
    // send result
    if (result == "ok" && !Emulator.ErrorDetected) return "Key was sent";
    return "Fail";
}
return "Element not found";
// find the html element
$he = $instance->ActiveTab->FindElementByTag("input:text", 0);
// check the element
if (!$he->IsVoid)
{
    // focus on this element
    $he->Focus();
    // send text
    $result = ZennoLab\Emulation\Emulator::SendText($instance->ActiveTab->Handle, "Simple text"); 
    // send result
    if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected) return "Key was sent";
    return "Fail";
}
return "Element not found";
Requirements

Target Platforms: Desktop: Windows XP SP3 and older. Server: Windows Server 2003 and older.

See Also

Reference

Emulator Class
Emulator Members
Overload List
SendKey Method
ErrorDetected Property

Send Feedback