I am using a gaming keyboard with a non-standard key 00 that instead of sending its own scancode sends 0 two times. The only way I found to be able to remap the 00 and 0 keys separately is to use this script:
https://www.autohotkey.com/docs/scripts/Numpad000.htm. I modified the code for the 00 key and to handle Shift and Ctrl modifiers. The key to remap is Left because I remapped Numpad0 to Left in the registry, but the concept is the same: when the code gets two 0/left arrow keys in a row, it should figure out if I pressed the 00/down arrow or 0/left arrow key based only on the interval in ms between the two keys. It was tricky to find the right ms value, and I am still not sure how that relates to the keyboard speed setting in the registry, but still the code seems to work except for one issue: when I press shift+down arrow or ctrl+down arrow and keep the key pressed down, it doesn't repeat the key. For example, shift+down in notepad would select only one row down from the cursor and then stop, while shift-up will keep on selecting rows as long as the key is pressed. Any help will be welcome.
Code: Select all
; KeyboardSpeed 16
; KeyboardDelay 2
#MaxThreadsPerHotkey 5 ; Allow multiple threads for this hotkey
*$Left::
#MaxThreadsPerHotkey 1
SetBatchLines, 100
DelayBetweenKeys = 40
if A_PriorHotkey = %A_ThisHotkey%
{
if A_TimeSincePriorHotkey < %DelayBetweenKeys%
{
if KeyCount =
{
KeyCount = 1
}
else
{
KeyCount = 0
Send, {Blind}{Down} ; when a modifier key is pressed, this works only once, not on repeat
}
CalledReentrantly = y
return
}
}
KeyCount = 0
CalledReentrantly = n
Sleep, %DelayBetweenKeys%
if CalledReentrantly = y
{
CalledReentrantly = n
return
}
Send, {Blind}{Left}
return