ZennoLab Assemblies Documentation
Emulator Class
Members  Example 
Represents methods for emulation of work with windows.
Object Model
Emulator Class
Syntax
public class Emulator 
Remarks
In this class represented the methods which can work with windows using the system handle or header (title) of the window.
Example
The following code example demonstrates uses of the some methods of Emulator class.
// set active window
string result = Emulator.ActiveWindow("Simple window");
// check result
if (result == "ok" && !Emulator.ErrorDetected)
{
    // send key "z"
    result = Emulator.SendKey("Simple window", 100, 200, System.Windows.Forms.Keys.Z, KeyboardEvent.Press);
    // check result
    if (result == "ok" && !Emulator.ErrorDetected)
    {
        // send text
        result = Emulator.SendText("Simple window",  100, 200, "Simple text", false);
        // check result
        if (result == "ok" && !Emulator.ErrorDetected)
        {
            // mouse move
            Emulator.MouseMove("Simple window",350, 370);
            // mouse click on button as result it will show save file dialog
            result = Emulator.MouseClick("Simple window", MouseButton.Left, MouseButtonEvent.Click, 350, 370);
            // check result
            if (result == "ok" && !Emulator.ErrorDetected)
            {
                // click on button with text "Save"
                return Emulator.ButtonClick("Save as", "Save");
            }
            else return "Fail";
        }
        else return "Fail";
    }
    else return "Fail";
}
else return "Fail";
// close window
result = Emulator.CloseWindow("Simple window");
// check result
if (result != "ok" || Emulator.ErrorDetected) return "Fail";
return "All done";
// set active window
$result = Emulator:ActiveWindow("Simple window");
// check result
if ($result == "ok" && !Emulator::ErrorDetected)
{
    // send key "z"
    $result = Emulator::SendKey("Simple window", 100, 200, System\Windows\Forms\Keys::Z, KeyboardEvent::Press);
    // check result
    if ($result == "ok" && !Emulator::ErrorDetected)
    {
        // send text
        $result = Emulator::SendText("Simple window",  100, 200, "Simple text", false);
        // check result
        if (result == "ok" && !Emulator.ErrorDetected)
        {
            // mouse move
            Emulator::MouseMove("Simple window", 350, 3700);
            // mouse click on button as result it will show save file dialog
            $result = Emulator::MouseClick("Simple window", MouseButton::Left, MouseButtonEvent::Click, 350, 370);
            // check result
            if ($result == "ok" && !Emulator::ErrorDetected)
            {
                // click on button with text "Save"
                return Emulator::ButtonClick("Save as", "Save");
            }
            else return "Fail";
        }
        else return "Fail";
    }
    else return "Fail";
}
else return "Fail";
// close window
$result = Emulator::CloseWindow("Simple window");
// check result
if ($result != "ok" || Emulator::ErrorDetected) return "Fail";
return "All done";
Inheritance Hierarchy

System.Object
   ZennoLab.Emulation.Emulator

Requirements

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

See Also

Reference

Emulator Members
ZennoLab.Emulation Namespace
KeyboardEvent Enumeration
MouseButton Enumeration
MouseButtonEvent Enumeration

Send Feedback