0

My left shift fails to work on some keys (e.g. nzbkd8.;) sometimes, while right shift always works on all keys. Reinstalled all keyboard drivers (Uninstall -> Reboot), issue persists. Trying an AHK workaround by remapping each individual key that fails via LShift, to RShift - but that's not working:

<+n::>+n        # LShift + n --> RShift + n
LShift::RShift  # testing only one at a time

The script reloads successfully, but is ineffective. Since LShift always works one some keys, I ruled out it being a broken key issue - i.e. the OS should always receive the LShift signal, so AHK should be able to capture it and remap to RShift, but this doesn't happen. Any resolution?


Additional info:

  • System: Win-10 Home, ASUS ROG Strix GL702VSK
  • AHK version: 1.1.29.01
  • Drivers: HID Keyboard Device (x2), PC/AT Enhanced PS/2 Keyboard (101/102-Key)
  • Your script maps left shift to right shift, but from the problem description I think you want to do just the opposite. – harrymc Feb 15 at 11:06
  • @harrymc Isn't the input to the left of :: and output to the right? Tried your suggestion regardless, didn't work - >+n::<+n in particular did nothing for LShift, but RShift outputs <N. – OverLordGoldDragon Feb 15 at 11:11
0

The following script will map right-shift to left-shift:

RShift::LShift

You can see the keys that are being pressed or mapped by opening the AutoHotkey window and using the menu View > Key history and script info and using F5 to refresh.

The mapping of <+n::>+n is not required and the syntax is wrong.

  • I should've clarified RShift::LShift is what I tried first; also, strangely, LShift never registers in the window unless followed-up by another key, whereas RShift does by itself. Also, in case my use intent isn't clear, it's a matter of convenience; RShift is much more awkward to press, and inhibits my typing speed, which is actually very problematic for my programming. – OverLordGoldDragon Feb 15 at 15:32
  • The above works fine for me, but perhaps it's something to do with some installed product on your computer. Check if the LShift problem arrives when booting in Safe mode. – harrymc Feb 15 at 15:36
  • Just did Safe Mode -> Minimal, still broke. Also, the behavior is strange: spamming LShift + n enough, eventually N is typed, and even several in a row. One instance, LShift refused to work at all - another, after 20 mins of no typing, if worked perfectly with all keys for a few minutes. The only installs I've done today are a few TensorFlow 2 reinstalls in separate virtual environments in Anaconda, and I doubt I have a virus, though I could run a full scan. – OverLordGoldDragon Feb 15 at 15:48
  • I noticed in the AHK Window, that if LShift + n doesn't N, then LShift isn't logged at all, only n. What's most unclear is how key registry is done "retroactively" - only deciding whether to register LShift or not based on subsequent keypresses. – OverLordGoldDragon Feb 15 at 15:51
  • You did Clean Boot, not Safe mode. If the problem is intermittent, this might be a hardware problem with the keyboard. In all cases, RShift::LShift should work and is what you asked for. – harrymc Feb 15 at 15:59
0

WIN + R and type shell:startup to create (or copy paste existing) script. This should make it so your scripts are being "Run as administrator".

https://i.stack.imgur.com/arrai.png

I think whatever issue you might be having is cause of that. I've had issues with that before. I tried to leave is as comment but I'm too weak a user. I do not have enough rep.


Here are some keys / links you might find helpful:

^ for CTRL
! for ALT
# for Windows Key
+ for Shift
Space ( ) %20 
Comma (,) %2C
Question Mark (?) %3F
Period (.) %2E
Exclamation Point (!) %21
Colon (:) %3A
Semicolon (;) %3B
0

Here's a .reg file that will remap LeftShift to send the RightSHift keycode.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"ScanCode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,36,e0,2a,00,00,00,\
  00,00

All one-to-one key remaps can be caccomplished this way. Here's my PowerShell(Admin!) script that allows me to add/remove mappings once scancodes are determined with a keyboard test utility:

##############################################################
$SimplePairs = @(
# 0x02, 0x4f # 1 ! > 1 end
# 0x03, 0x50 # 2 @ > 2 ↓
# 0x04, 0x51 # 3 # > 3 pg dn
# 0x05, 0x4b # 4 $ > 4 ←
# 0x06, 0x4c # 5 % > 5
# 0x07, 0x4d # 6 ^ > 6 →
# 0x08, 0x47 # 7 & > 7 home 
# 0x09, 0x48 # 8 * > 8 ↑
# 0x0a, 0x49 # 9 ( > 9 pg up
# 0x0b, 0x52 # 0 ) > 0 Ins
# 0x34, 0x53 # . > > . Del
# 0x00, 0x3a # Null > CapsLock
)
$ExtendedPairs = @(
 0x36, 0xe0, 0x2a, 0x00 # Right-Shift(0xe036) > Left-Shift(0x002a)
# 0x5d, 0xe0, 0x1d, 0xe0 # ContextMenu(0xe05d) > R Ctrl(0xe01d)
)
$ByteCount = 2 * $SimplePairs.Length + $ExtendedPairs.Length + 16
$Remap = New-Object -TypeName byte[] -ArgumentList $ByteCount
$Remap.Length
$Remap[8] = $SimplePairs.Length/2 + $ExtendedPairs.Length/4 + 1
For ($i = 0 ; $i -lt $SimplePairs.Length ; $i += 2) {
   $Remap[$i * 2 + 12] = $SimplePairs[$i]
   $Remap[$i * 2 + 14] = $SimplePairs[$i + 1]
}
For ($i = 0 ; $i -lt $ExtendedPairs.Length ; $i += 4) {
   $Offset = $SimplePairs.Length * 2
   $Remap[$i + 12 + $Offset] = $ExtendedPairs[$i]
   $Remap[$i + 13 + $Offset] = $ExtendedPairs[$i + 1]
   $Remap[$i + 14 + $Offset] = $ExtendedPairs[$i + 2]
   $Remap[$i + 15 + $Offset] = $ExtendedPairs[$i + 3]
}
$Splat = @{
Path  = 'HKLM:\SYSTEM\CurrentControlSet\Control\Keyboard Layout'
Name  = 'ScanCode Map'
Value = $Remap
Force = $True
}
$Splat['Value'] | format-hex
New-ItemProperty @Splat

  • What is this registry editor you use? This is what I see when I navigate to your shown folder in the default editor. Do I just make a .reg file and dump it straight in there? – OverLordGoldDragon Feb 22 at 3:44
  • I use the default registry editor. The ScanCode Map vallue doesn't exist by default, as normally none is needed. The first block I posted can be saved as a `.reg`` file & merged. A Restart isnecessary for the value to be read. The more elaborate code is a PowerShell script that can be easily modified to remap different keys and all the byte array magic is done by the code. – Keith Miller Feb 22 at 4:21
  • In PowerShell code #is the comment indicator. So in the code I posted, all the remaps (ones I've created at other times) are commented out except RShift=>LShift. I left them in as examples for those who want to play with the code. The numeric set of remaps assigns the top-row number key codes to the numeric keypad keys --- so the numeric keypad is always numbers regardless of NumLock state! – Keith Miller Feb 22 at 4:27
  • Now my LShift died entirely, so @harrymc was likely correct on it being a hardware issue, so I can't even test this - thanks for the info regardless – OverLordGoldDragon Feb 23 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.