Simulate-Drag
Command Description
Drag the mouse from one location to another
Command Prototype
Mouse.Drag(sx, sy, dx, dy, iButton, sKeyModifiers,optionArgs)
Parameter Description
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
sx | True | number | 0 | The X-coordinate of the mouse before it was dragged |
sy | True | number | 0 | The Y-coordinate of the mouse before it was dragged |
dx | True | number | 0 | The X-coordinate of the mouse after it was dragged |
dy | True | number | 0 | The Y-coordinate of the mouse after it was dragged |
iButton | True | enum | "left" | Mouse button {left: Left button, right: Right button, middle: Middle button} |
sKeyModifiers | True | set | [] | Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win |
iDelayAfter | None | number | 300 | Delay time (in milliseconds) after executing the activity is 300 milliseconds |
iDelayBefore | None | number | 200 | The delay time (in milliseconds) before any operations are executed is by default 200 milliseconds |
Demo
TracePrint "--------------------simulate drag--------------------"
// --------------------------------------------------------
// [Remarks] Simulate drag
// Input parameter 1:
// sx--Starting abscissa
// Input parameter 2:
// sy--start ordinate
// Input parameter 3:
// dx--end abscissa
// Input parameter 4:
// dy--end ordinate
// Input parameter 5:
// iButton--mouse click (left/right/middle)
// Input parameter 6:
// sKeyModifiers--Auxiliary keys
// Input reference 7:
// optionArgs--Optional parameters (including: delay after execution/delay before execution).Type:Dict
// Command prototype: Mouse.Drag(sx, sy, dx, dy, iButton, sKeyModifiers,optionArgs)
// --------------------------------------------------------
Mouse.Drag(0, 0, 100, 100, "left", [],{"iDelayAfter": 300, "iDelayBefore": 200})