Page 1 of 1

InstallMouseHook vs Mousemove

Posted: 17 Feb 2019, 11:43
by potscrubber
Hello Community

Wondering if anyone can shed light on my issue. In this usage case I have two different scripts active. Script 1 invokes #InstallMouseHook and a HotKey. If Script 1 is active, Script 2's operations with MouseMove are severly impeded. The "mouse moves" several factors slower if Script 1's #InstallMouseHook and Hotkey are active. Can anyone help me trouble-shoot the mechanism behind this?
Note 1: Script 2's MouseMove's take place within a BlockInput, On/Off segment of code.
Note 2: Both scripts are running with full elevation on Win10 Pro x64

Many thanks for any illuminations!

Re: InstallMouseHook vs Mousemove  Topic is solved

Posted: 17 Feb 2019, 13:52
by swagfag
the reason
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.
the solution SetMouseDelay -1

Re: InstallMouseHook vs Mousemove

Posted: 17 Feb 2019, 15:10
by Helgef
Or even, SetMouseDelay -1, -1. Additionally, if you didn't specify the speed for mousemove,you could add setdefaultmousespeed 0.


Edit: strike

Re: InstallMouseHook vs Mousemove

Posted: 17 Feb 2019, 18:22
by swagfag
i dont think SetMouseDelay -1, -1 would do anything different. the second arg has to be the string "Play", if at all present

Re: InstallMouseHook vs Mousemove

Posted: 18 Feb 2019, 01:40
by Helgef
Hehe, that's right.

Re: InstallMouseHook vs Mousemove

Posted: 20 Feb 2019, 03:43
by potscrubber

Thanks a lot for the information. You pointed me to a path that resulted in a happy resolution by doing a SendMode Event before each MouseMove (and back to SendMode Input after it) in Script 2. I must admit the SendMode's have been a very fuzzy area for me as I tend to use AHK mostly for an easy little app language rather than too much manipulation of other prog's. Anyway thanks again for the help and education.