Unable to change MouseSpeed in a122-123 [SOLVED]

Discuss the future of the AutoHotkey language
tomjtoth
Posts: 7
Joined: 11 Sep 2019, 13:20

Unable to change MouseSpeed in a122-123 [SOLVED]

24 Feb 2021, 13:48

Issue: MouseMove, MouseClickDrag ignore any value passed as speed

My setup:
AHK/main.bat

Code: Select all

start "" /min "%~dp0bin\AutoHotkeyU64_2.0-a123-e5801ee8.exe" "%~dp0\lib\main.ahk"
launches AHK/lib/main.ahk:

Code: Select all

#include config.ahk
...
which includes the rest of my "modules" and creates a configuration blob (multi-level object)
The AHK folder is constantly synced by OneDrive

calling mouse related functions (via hotkeys) move instantly, even if I insert

Code: Select all

sleep 500
tooltip("0,0")
mousemove 100, 100,100, "R"
tooltip("100,100")
to the beginning of main.ahk, the mouse moves instantly. I tried changing the default mouse speed, delay and did not pass anything as speed, didn't help. I also tried including the unicode BOM in each any every one of the involved .ahk files, no luck.

I spotted this in a122, is still present in a123, haven't tried a124 yet.
Last edited by tomjtoth on 25 Feb 2021, 02:42, edited 1 time in total.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Unable to change MouseSpeed in a122-123

24 Feb 2021, 15:06

Speed is ignored for SendInput/Play modes; they move the mouse instantaneously
SendMode('Input') being the default in v2
tomjtoth
Posts: 7
Joined: 11 Sep 2019, 13:20

Re: Unable to change MouseSpeed in a122-123

25 Feb 2021, 02:37

well I'll be damned,
I never thought about changing between sendmodes, I tested though that writing a simple .txt file which includes only the below code:

Code: Select all

msgbox(A_SendMode )
mousemove 200, 200, 100, "R"
and dropping it on the same binary does return "input" and work as expected (slowly, at speed 100)
on the other hand when I include the same check in my function, it also returns "input", but then the mouse gets moved instantly...

upon including

Code: Select all

sendmode("event")
before the mousemove command in my function, it does seem to do the trick
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Unable to change MouseSpeed in a122-123 [SOLVED]

25 Feb 2021, 03:08

thats because depending on what scripts are currently running, SendMode Input might not actually be in effect: https://lexikos.github.io/v2/docs/commands/Send.htm#SendInputUnavail
tomjtoth
Posts: 7
Joined: 11 Sep 2019, 13:20

Re: Unable to change MouseSpeed in a122-123 [SOLVED]

25 Feb 2021, 08:42

Nice, I must admit my main script was always running in the background when testing those few-liners, so SendEvent for the win :D
thanks a lot for the quick replies!

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 65 guests