Move mouse smoothly

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
learningahk
Posts: 5
Joined: 06 Jul 2020, 17:42

Move mouse smoothly

07 Jul 2020, 11:14

Currently, my script moves the mouse up and down a randomized number between 1 and 10. I want the script to move smoothly and not instantly. However, with "SendMode Input" I do not believe it is possible to make the mouse move smoothly.For reference:
Speed is ignored for SendInput/Play modes; they move the mouse instantaneously
(https://www.autohotkey.com/docs/commands/MouseMove.htm)

I solved this by using "SendMode Event" but this brings a new problem. Using SendMove Event results in the mouse movements not being equal, so the mouse doesn't return it its original position (hence the negative movement and then the same magnitude positive movement). Is it possible to make the mouse move smoothly using SendMode Input or make the mouse move the same magnitude up then down?

Code: Select all

#NoEnv
; #Warn
SetWorkingDir %A_ScriptDir%
SendMode Event
^`::
Random, ranup, 1, 10
MouseMove, 0, -%ranup%, 100, R
sleep, 1000
MouseMove, 0, %ranup%, 100, R
return
Last edited by BoBo on 07 Jul 2020, 11:25, edited 1 time in total.
Reason: Added provisional subject line.
User avatar
Scr1pter
Posts: 1272
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Move mouse smoothly

07 Jul 2020, 12:37

Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mikeyww, ulysim and 322 guests