Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
XShayanX
Posts: 83
Joined: 16 Sep 2018, 04:48

Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events?

18 Sep 2020, 03:03

Hello! I have been having this problem that after some time when I run my script, the WheelDown/WheelUp hotkeys stop working on Full Screen Windows (like when you hit F11 on Google Chrome), and I have to reload my script and they work again.

When I check 'Key History And Info', I see that Wheel events are not getting picked up by the script ALTHOUGH Mouse Hook and Keyboard Hook are both installed (active on script).

Image

In the picture above, the AHK window 1, is a script that I just started, and is able to see the Wheel events.
And the AHK window 2, is a script that has been running for some hours, and is not able to see the wheel events.

Here's how my code looks like:

Code: Select all

GroupAdd, Games, ahk_class LWJGL
GroupAdd, Games, ahk_class Valve001
GroupAdd, Games, ahk_class UnrealWindow
GroupAdd, Games, ahk_exe Steam.exe
GroupAdd, Games, ahk_exe h1z1.exe
GroupAdd, Games, ahk_exe Realm.exe
GroupAdd, Games, ahk_exe hl2.exe

CheckMousePosition(){
	CoordMode, Mouse, Screen
	MouseGetPos , MouseXFullScreenHotkey, MouseYFullScreenHotkey
	If (MouseXFullScreenHotkey > 1915) AND (MouseYFullScreenHotkey < 5)
		return 2
	Else If (MouseXFullScreenHotkey < 5) AND (MouseYFullScreenHotkey < 5)
		return 1
	Else
		return 0
}

#If !WinActive("ahk_group Games") AND CheckMousePosition() = 1
WheelUp::run A:\nircmd-x64\nircmd.exe changebrightness +10
WheelDown::run A:\nircmd-x64\nircmd.exe changebrightness -10

#If !WinActive("ahk_group Games") AND CheckMousePosition() = 2
WheelUp::Volume_Up
WheelDown::Volume_Down

#If
Last edited by BoBo on 18 Sep 2020, 06:29, edited 2 times in total.
Reason: Removed to 'Ask for Help' after an intervention by the OP.
XShayanX
Posts: 83
Joined: 16 Sep 2018, 04:48

Re: Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events?

18 Sep 2020, 05:16

@BoBo Hello mister, this is not a gaming question, I'm actually using #If !WinActive("ahk_group Games") because I want my script's hotkeys to NOT WORK on games.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events?

18 Sep 2020, 06:27

Hi. You'll admit that using 'Games' in the first 7 lines of your code alone gives a reasonable hint for why to move that thread.
Nevertheless, you're right. So, let's move again ;)
XShayanX
Posts: 83
Joined: 16 Sep 2018, 04:48

Re: Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events?

18 Sep 2020, 06:30

You're 100% correct, sorry for the bother, thanks very much ^-^
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: Is it a known bug where after sometime the AHK script will not be able to see mouse wheel events?  Topic is solved

25 Sep 2020, 04:06

No, there is no such known bug (and I believe there is no such unknown bug either).

AutoHotkey can only tell you whether it has called the appropriate function to register its mouse hook, and has not yet called the appropriate function to unregister its mouse hook. It cannot tell you what it does not know: whether the system will call the hook, or what events the system is not notifying it about.

See #IfTimeout for some known cases where the system may stop calling a hook.

Other programs may register a hook and may prevent previously registered hooks from being called. For instance, the Windows Remote Desktop client and similar third-party programs are known to do this (for keyboard, at least), but only while they have the focus.

If the target window of a mouse event belongs to a process with a higher integrity level than the script (e.g. a process running as administrator when the script is not), the script is not notified of that event.

If you suspend all hotkeys that require a given hook and it is not needed for any other purpose, the hook is unregistered. Un-suspending the hotkeys will cause the hook to be re-registered, giving it precedence over any previously installed hooks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Descolada, inseption86, jaka1 and 435 guests