ZennoLab Assemblies Documentation
MouseMove(String,Int32,Int32,Boolean) Method
Example 

Type: System.String

The header of the window.

Type: System.Int32

The x coordinate relative to the window.

Type: System.Int32

The y coordinate relative to the window.

Type: System.Boolean

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

Moves the mouse to a specified location in the specified window.
Syntax
public static string MouseMove( 
   string windowName,
   int x,
   int y,
   bool topMost
)

Parameters

windowName

Type: System.String

The header of the window.

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.
Example
The following code example demonstrates uses of the MouseMove method.
// random
Random rnd = new Random();
// x location
int x = 200;
// y location
int y = 200;
// offset X
int offsetX = rnd.Next(100);
// offset y
int offsetY = rnd.Next(100);
// move mouse to start location x = 200 and y = 200 on "Window" window 
string result = Emulator.MouseMove("Window", x, y);
// check result
if (result != "ok" && Emulator.ErrorDetected) return "Fail";
// mouse move to a new location
result = Emulator.MouseMove("Window", x + offsetX, y + offsetY);
// check result
if (result != "ok" && Emulator.ErrorDetected) return "Fail";
// answer
return String.Format("Mouse was moved from x = {0}; y = {1} to x = {2}; y = {3}", x, y, x + offsetX, y + offsetY);
// random
$rnd = new Random();
// x location
$x = 200;
// y location
$y = 200;
// offset X
$offsetX = $rnd->Next(100);
// offset y
$offsetY = $rnd->Next(100);
// move mouse to start location x = 200 and y = 200 on "Window" window
$result = ZennoLab\Emulation\Emulator::MouseMove("Window", $x, $y);
// check result
if ($result != "ok" && ZennoLab\Emulation\Emulator::ErrorDetected) return "Fail";
// mouse move to a new location
$result = ZennoLab\Emulation\Emulator::MouseMove("Window", $x + $offsetX, $y + $offsetY);
// check result
if ($result != "ok" && ZennoLab\Emulation\Emulator::ErrorDetected) return "Fail";
// answer
return String::Format("Mouse was moved from x = {0}; y = {1} to x = {2}; y = {3}", $x, $y, $x + $offsetX, $y + $offsetY);
Requirements

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

See Also

Reference

Emulator Class
Emulator Members
Overload List
ButtonClick Method
MouseClick Method
ErrorDetected Property

Send Feedback