Page 1 of 1

Bug that was driving me insane for a week was actually a bug with AHK itself

Posted: 01 Feb 2024, 19:28
by NovaChromatic
So back in August last year, I was driving myself insane for a week trying to fix a bug. I planned on asking for help here, even drafted a long-ass explanation with a crap-ton of comments, but never got around to posting it.

Jump to now where I'm revisiting the code and it's actually working – no more bug? Then I come to find out it was actually a bug with AHK itself that was fixed in v2.0.7, less than a month after I initially encountered the bug.

I feel both validated and annoyed that I never posted it, lol.

Here's an example of the bug (easy to see the simplified version in hindsight):

Code: Select all

0:: Shift
; You should be able to trigger the below hotkey by pressing 0 & 1,
; but in v2.0.6 and below, you can't.
$+1:: MsgBox()
The specific fix found in the v2.0.7 notes is "Fixed hook hotkeys not recognizing modifiers which are pressed down by SendInput."

Really just posting this for catharsis.

Re: Bug that was driving me insane for a week was actually a bug with AHK itself

Posted: 14 Feb 2024, 00:17
by Chunjee
Oof that's painful


Lucky that got fixed in the end

Re: Bug that was driving me insane for a week was actually a bug with AHK itself

Posted: 14 Feb 2024, 13:56
by flyingDman
That "0 & 1" script works but it disables the 0 key.
I am always surprised when people are attempting to make odd key combinations work. There are literally hundreds of viable keyboard combinations available using the "normal" modifiers. Why complicate your life?

Re: Bug that was driving me insane for a week was actually a bug with AHK itself

Posted: 14 Feb 2024, 15:29
by RussF
flyingDman wrote:
14 Feb 2024, 13:56
That "0 & 1" script works but it disables the 0 key.
I am always surprised when people are attempting to make odd key combinations work. There are literally hundreds of viable keyboard combinations available using the "normal" modifiers. Why complicate your life?
+1

Then there's,"I want my shift key to do 'this' on a short press, 'that' on a medium press, 'the other thing' on a long press, but I want it to do 'something else' on a double-press and 'one more thing' on a triple-press. Please write the script for me." :roll:

Russ

Re: Bug that was driving me insane for a week was actually a bug with AHK itself

Posted: 02 Apr 2024, 22:02
by NovaChromatic
flyingDman wrote:
14 Feb 2024, 13:56
That "0 & 1" script works but it disables the 0 key.
The code I gave was an abstraction, but the goal was to remap a non-modifier key to a modifier. To be specific, I wanted to map CapsLock+S to Shift. But yes, I've realized since then that using the native modifiers is simpler to code and simpler for the brain to remember.