Bug: SetDefaultMouseSpeed and Send '{Click X Y}'

Discuss the future of the AutoHotkey language
Posts: 18
Joined: 16 Oct 2018, 14:11
GitHub: Ursi

Bug: SetDefaultMouseSpeed and Send '{Click X Y}'

18 Oct 2018, 17:43

From the docs: "SetDefaultMouseSpeed is ignored for SendInput/Play modes; they move the mouse instantaneously"
However, send[Input] '{click x y}' does not move the mouse instantaneously unless setDefaultMouseSpeed 0 has been used first. This also applies to click and probably everything else that's supposed to move the mouse instantaneously by default.
Posts: 6207
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Bug: SetDefaultMouseSpeed and Send '{Click X Y}'

02 Nov 2018, 23:41

My testing on v1.1.30 confirmed that Click (in either form) is instantaneous when it operates in SendInput mode or SendPlay mode.

However, it is not instantaneous when SendInput (or Send/Click with SendMode 'Input') operates in SendEvent mode due to the presence of a separate script with a keyboard/mouse hook. It can be hard to notice when this occurs since SetKeyDelay is ignored.
SendInput wrote:Note: SendInput ignores SetKeyDelay because the operating system does not support a delay in this mode. However, when SendInput reverts to SendEvent under the conditions described below, it uses SetKeyDelay -1, 0 (unless SendEvent's KeyDelay is -1,-1, in which case -1,-1 is used). When SendInput reverts to SendPlay, it uses SendPlay's KeyDelay.

If a script other than the one executing SendInput has a low-level keyboard hook installed, SendInput automatically reverts to SendEvent (or SendPlay if SendMode InputThenPlay is in effect). This is done because the presence of an external hook disables all of SendInput's advantages, making it inferior to both SendPlay and SendEvent. However, since SendInput is unable to detect a low-level hook in programs other than [AutoHotkey v1.0.43+], it will not revert in these cases, making it less reliable than SendPlay/Event.
In the true SendInput mode, all events (keypress, keyrelease, left/right/middle button down/up, mouse move, etc.) are placed into an array, and this array is passed to the native SendInput function. The key delay and mouse speed parameters are not used as the native SendInput function does not provide any control over timing.

This is not specific to AutoHotkey v2 (except for the single quotes in the posted code).

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 7 guests