Student Mode Code Display

Welcome to the Fraternity!

Commenting has been enabled. You can comment on all the Code Items now.

Mouse Operation using Mercury Device Replay


Add This Code to My Favourite List
Enter Email

Contributed By admin
Date 2016-04-15 11:30:48

'Tutorial: itprof_tut
'Creating Wscript Shell and Device Replay objects

'Create oShell Object and oDevice Replay Object
Set oShell= CreateObject("WScript.Shell")
Set oDevice= CreateObject("Mercury.DeviceReplay")

'Get the X and Y co-ordinate of the Object on which
'mouse is to be hovered or clicked

'abs_x and abs_y should be taken instead of x and y
'abs_x and abs_y takes counts from top of the windows screen

abs_x=Browser("Browser").Page("Page").WebEdit("xyz").GetROProperty ("abs_x")
abs_y=Page("Page").WebEdit("xyz").GetROProperty ("abs_y")


'Moving and Clicking Left Mouse button
'5 is added to both x and y to perform the operation over the object
'to avoid doing it over the edge of the object
oDevice.MouseClick abs_x+5, abs_y+5
wait 5
oDevice.MouseClick abs_x+5, abs_y+5, 1   

'Pressing Enter key
'Keys can be sent by device replay as well as Wshell
'Wshell can not do Mouse operations but Device replay can
oShell.sendKeys "{ENTER}"

'or
'oDevice.SendString "{ENTER}"

'Releasing the objects
Set oShell=Nothing
Set oDevice=Nothing


'Device Replay Other Functions and their arguments
'Function                                 Description
'MouseMove x, y                           Move the mouse to the screen coordinate (x,y).
'MouseClick x, y, button                  Move the mouse to the screen coordinate (x,y) and click the button
'MouseDblClick x, y, button               Move the mouse to the screen coordinate (x,y) and double-click the button
'DragAndDrop x, y, dropx, dropy, button   Drag the mouse from screen coordinate (x,y) to (dropx,dropy) with the button
'PressKey key                             Press a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab."
'MouseDown x, y, button                   Press the mouse button on screen coordinate (x,y).
'MouseUp x, y, button                     Release the mouse button on screen coordinate (x,y).
'KeyDown key                              Press a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab."
'KeyUp key                                Release a key using the ASCII code of the key.
For example, Chr(13), vbCR and vbTab."
'SendString string                        Type a string
'Note: Button indicate as follows:
'button =>(0=left; 1=middle; 2=right).

Download Above Code

Comments:



Add your comments...
Name : *      
Email : *      
The content of this field will be kept private and will not be shown publicly

Your Comment/Answer *

Enter the text present in this box : *