Method MouseClickDrag

AutoIt X

Method Reference


MouseClickDrag

Perform a mouse click and drag operation

MouseClickDrag "button", x1, y1, x2, y2 [, speed]

Parameters

button The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary".
x1, y1 The x/y coords to start the drag operation from.
x2, y2 The x/y coords to start the drag operation to.
speed Optional: the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.

Return Value

None.

Remarks

If the button is an empty string, the left button will be clicked.

If the button is not in the list, then oAutoIt.error will be set to 1.

If the user has swapped the left and right mouse buttons in the control panel, then the behaviour of the buttons is different. "Left" and "right" always click those buttons, whether the buttons are swapped or not. The "primary" or "main" button will be the main click, whether or not the buttons are swapped. The "secondary" or "menu" buttons will usually bring up the context menu, whether the buttons are swapped or not. See the table in MouseClick for more explaination

Related

MouseClick, MouseCoordMode (Option), MouseGetPosX, MouseGetPosY, MouseMove

Example


Set oAutoIt = WScript.CreateObject("AutoItX3.Control")

' Left click drag from 0,200 to 600, 700
oAutoIt.MouseClickDrag "left", 0, 200, 600, 700