ZennoLab Assemblies Documentation
MouseClick(String,MouseButton,MouseButtonEvent,Int32,Int32,Boolean) Method
See Also  Example Send Feedback
ZennoLab.Emulation Assembly > ZennoLab.Emulation Namespace > Emulator Class > MouseClick Method : MouseClick(String,MouseButton,MouseButtonEvent,Int32,Int32,Boolean) Method
windowName

Type: System.String

The header of the window.

button

Type: ZennoLab.Emulation.MouseButton

The mouse button for emulation.

buttonEvent

Type: ZennoLab.Emulation.MouseButtonEvent

The event of mouse button for emulation.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to the window.

topMost

Type: System.Boolean

true if need to show the window on top of all; otherwise, false. Default value is false.

Glossary Item Box

Emulates the mouse's events in the specified window.

Syntax

C# 
public static string MouseClick( 
   string windowName,
   MouseButton button,
   MouseButtonEvent buttonEvent,
   int x,
   int y,
   bool topMost
)

Parameters

windowName

Type: System.String

The header of the window.

button

Type: ZennoLab.Emulation.MouseButton

The mouse button for emulation.

buttonEvent

Type: ZennoLab.Emulation.MouseButtonEvent

The event of mouse button for emulation.

x

Type: System.Int32

The x coordinate relative to the window.

y

Type: System.Int32

The y coordinate relative to the window.

topMost

Type: System.Boolean

true if need to show the window on top of all; otherwise, false. Default value is false.

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.

Remarks

There are several ways of calling this method. The parameter topMost have the default value and you can call the method without this parameter.

The x and y can be -1. In this case the click will be performed to the current window.

Example

The following code example demonstrates uses of the MouseClick method. First of all in this part of code call MouseClick method and as result it opens the save file dialog. Then waits two seconds (the time to display the window) and clicks on button with caption " Save " in window with header " Save as " using ButtonClick method.
C#Copy Code
// show the save file dialog
string result = Emulator.MouseClick("Simple window", MouseButton.Left, MouseButtonEvent.Click, 200, 200);
// wait a little bit
System.Threading.Thread.Sleep(2000);
// if mouse click was successful
if (result == "ok" && !Emulator.ErrorDetected)
{
    // click on button with caption "Save"
    result = Emulator.ButtonClick("Save as", "Save");
    // make answer
    if (result == "ok" && !Emulator.ErrorDetected) return "All done";
    else return "Fail";
}
PHPCopy Code
// show the save file dialog
$result = ZennoLab\Emulation\Emulator::MouseClick("Simple window", MouseButton::Left, MouseButtonEvent::Click, 200, 200);
// wait a little bit
System\Threading\Thread::Sleep(2000);
// if mouse click was successful
if ($result == "ok" && !Emulator::ErrorDetected)
{
    // click on button with caption "Save"
    $result = ZennoLab\Emulation\Emulator::ButtonClick("Save as", "Save");
    // make answer
    if ($result == "ok" && !ZennoLab\Emulation\Emulator::ErrorDetected) return "All done";
    else return "Fail";
}

Requirements

Target Platforms: Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2014 All Rights Reserved.