Click Position Move To Absolute Location - Drag Mouse

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
j8975

Click Position Move To Absolute Location - Drag Mouse

22 Jun 2017, 10:25

Hi

I am trying to do a simple task i thought

Click at current cursor position and Drag to an Absolute location on the active screen

Numpad2::MouseClickDrag, L, 50, 630


How can i make this drag from current click posiiton to an absolute position

I am dragging items from current click position to a absolute posiiton

I have looked at the docs but i cant seem to figure it out i read about cord mode but that didnt work

Thank you
User avatar
boiler
Posts: 16932
Joined: 21 Dec 2014, 02:44

Re: Click Position Move To Absolute Location - Drag Mouse

22 Jun 2017, 19:15

It is simple. The docs show that you need two sets of coordinates, and what you showed only has one. Use MouseGetPos to determine the current position, and use that for X1, Y1. Use the coordinates you want to drag to as X2, Y2.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Click Position Move To Absolute Location - Drag Mouse

22 Jun 2017, 23:55

You probably want something like this, change the numbers as appropriate:

Code: Select all

Numpad2::
CoordMode, Mouse, Screen
MouseGetPos, vMouseX, vMouseY
MouseClickDrag, L, % vMouseX, % vMouseY, 0, 0
return
This script needs 3 lines of code (4 if you include the 'return'), so you can't do it as a one-liner 'hotkey::code line' hotkey.

I always like to test mouse dragging on MS Paint, it's very visual. It draws a straight line between 2 points.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 268 guests