It's a workaround for broken G910 Logitech keyboards (possibly other keyboards too) whereby some keys occasionally register multiple keystrokes for one kkkkkeypress. The key bug appears because keyboard registers multiple keystrokes in a very short timespan even though you pressed the key only once. This script makes it so the subsequent keystrokes registered in a very short timespan are ignored thus outputing the key only for the first stroke.
You need install AutoHotkey v1 (Windows only). https://www.autohotkey.com/. A software to hijack keystrokes and assign them different functions. Note that year later after I've made this script that AutoHotkey v2 was released and this gist is not compatible with it. However, AHK v1 and v2 can run on the same computer without conflict. Then download the G910 Keyboard Fix.ahk file above, change the configuration in it, save and then double click it. You can add this file to Windows autostart if needed.
There are two variables that affect the script. The first one brokenKeys is mandatory to be set to fit your scenario. The second one fixOffset is optional:
Line 8: brokenKeys
Set this variable so in the quotes there are only your broken keys listed.
Line 16: fixOffset
You can leave as is or just to fit your requirements for auto repeat requirements (read comments in code).
Problem with this keyboard is discussed on various forums. https://www.reddit.com/r/LogitechG/comments/b8pqj9/g910_double_typing/ https://www.reddit.com/r/LogitechG/comments/fstryp/g910_keyboard_keys_double_typing/ https://www.reddit.com/r/LogitechG/comments/cu1uaa/ghub_causing_random_keypresses_or_ghostkey/
Above links suggest also other possible solutions (none worked for me, hence the script above).
- Take your keys out and clean you keybard connections,
- Change USB socket to which the keyboard is connected
- Type your broken key like crazy for several minute until it fixes itself (some folks suggested it cleans the rust)
- Quit or uninstall G-Hub
- Go to Control Panel > Keyboard and change Repeat delay to longer one. Also can try to change slower Repeat rate.
@johntor
No version for Autohokey v2. AHK v2 was released year after I've made this gist.
Having said that AHK 1 and 2 can run on the same machine without conflict. It runs as such on my computer and documentation confirms the same: https://www.autohotkey.com/v2/
@Woserite
@InsaneAwesomeTony
This script is no good for super fast typing and keypresses required for gaming because its main purpose it to slow repetitions and whacking WSAD like crazy will be registered as the glitch this script is meant to fight.
@Dom-Luck
You can just add all the keys in the settings.
I no longer have this keyboard to make any sensible tests and in general I won't be maintaining this code as it's no longer relevant to me personally (unless my new keyboard will start going crazy in the same way :P) but I see some forks and good comments you guys and girls can build improvements on.