FunctionMouse_click (x, y)
DimDevice
SetDevice =Createobject("Mercury. devicereplay ")
Device. mousemove X, Y
Device. mouseclick X, Y, left_mouse_button
End Function
The mercury. devicereplay object is used to simulate Mouse clicking and moving, keyboard input, and so on. However, before using this object, you must ensure that the keyboard status is correct. For example, whether numlock is enabled, because devicereplay cannot detect the keyboard status.
Mercury. devicereplay includes the following methods:
1. sendstring Method
Send one or more keyboard buttons to the activated window: object. sendstring (STR)
2. keydown Method
Simulate the pressing and holding of a key: object. keydown (key)
Key: Numeric Value of the key.
3. keyup Method
Simulate releasing a pressed key through the keyboard: object. keyup (key)
4. presskey Method
Press the next button on the keyboard and immediately release: object. presskey (key)
5. pressnkeys Method
Simulate pressing the next button multiple times on the keyboard and immediately releasing: object. pressnkey (Key, n)
N: Repeated times
6. draganddrop Method
This operation is used to drag objects from one point to another: object. draganddrop (dragx, dragy, dropx, dropy, button)
The button values include:
Left_mouse_button = 0
Middle_mouse_button = 1
Right_mouse_button = 2
7. mouseclick Method
Click the object. mouseclick (X, Y, button) with the left or right mouse button at the specified screen position)
8. mousedbclick Method
Double-click object. mousedblclick (X, Y, button)
9. mousedown Method
Press the Left or Right button at the specified position on the screen and keep the following status: object. mousedown (X, Y, button)
10. mouseup Method
The mouse button used to release the previously executed mousedown method: object. mousedown (X, Y, button)
11. mousemove Method
Used to simulate mouse movement: object. mousemove (x, y)
12. setsynchronizationtimeout Method
Set a new synchronization timeout value: object. setsynchronizationtimeout (nsynctimeout, is_sec)
Nsynctimeout: Specifies the synchronization timeout value.
Is_sec: Specifies whether the set time value is in seconds