Skip to main content

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

ParameterRequiredTypeDefaultDescription
sxTruenumber0The X-coordinate of the mouse before it was dragged
syTruenumber0The Y-coordinate of the mouse before it was dragged
dxTruenumber0The X-coordinate of the mouse after it was dragged
dyTruenumber0The Y-coordinate of the mouse after it was dragged
iButtonTrueenum"left"Mouse button {left: Left button, right: Right button, middle: Middle button}
sKeyModifiersTrueset[]Keyboard keys used while a mouse action is triggered: Alt, Ctrl, Shift, Win
iDelayAfterNonenumber300Delay time (in milliseconds) after executing the activity is 300 milliseconds
iDelayBeforeNonenumber200The 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})