How to prevent buffering/queueing of mousewheel when assigning it as a hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Raghava Doregowda
Posts: 130
Joined: 06 Nov 2022, 01:48

How to prevent buffering/queueing of mousewheel when assigning it as a hotkey

Post by Raghava Doregowda » 03 Feb 2023, 00:58

I've assigned the mousewheel's scroll i.e. WheelDown and WheelUp as hotkeys to carry out some repeated tasks. The way the wheel works is a little clumsy. If I rotate the wheel by one step (till the ratchet just locks on) the hotkey gets executed. But it's tricky to rotate it just one step when we're involved in work or in a hurry and sometimes the ratchet slips to 2 or more. In such a situation, the hotkey gets passed in succession which was originally meant to be passed one time only. How to prevent this? Rather, how to ensure that if I scroll by one stroke of the finger, no matter how many times the ratchet rotates, the hotkey gets executed once. And once the execution is complete, then if I call the hotkey in succession, it executes. In a nutshell,what I mean is in Modern windows, especially during bootup, if you spam double clicks on folders and the computer is stagnant due to bootup, it won't consider all the times I went on double clicking it. Instead it'll open only one instance and work as normal as it should after the computer speeds up after bootup
So is there a way to work this out?

Rohwedder
Posts: 7628
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How to prevent buffering/queueing of mousewheel when assigning it as a hotkey

Post by Rohwedder » 03 Feb 2023, 01:47

Hallo,
try:

Code: Select all

~WheelUp::
~WheelDown::
IF (A_ThisHotkey = A_PriorHotkey And A_TimeSincePriorHotkey < 500)
	Return
SoundBeep, 4000, 20
Return
The number of clicks of the scroll wheel usually has nothing to do with the number of mouse wheel events sent. With my mouse I have broken out this annoying ratchet.

Post Reply

Return to “Ask for Help (v1)”