AutoHotkey – How to Find User’s Keyboard Layout Change Method

autohotkeykeyboard-layout

I've written an AutoHotKey script which changes keyboard layout by pressing CapsLock.
Pressing CapsLock simply emulates "LeftAlt down + Left Shift + LeftAlt Up" combination.
It's obvious, that my program won't work if Control+Shift is set to keyboard layout change method.
I've tried searching over registry, but there's no useful information in HKLM/System/CurrentControlSet/Control/Keyboard Layout(s).

So, is it possible somehow to find out user's method to change layout?

Best Answer

Keyboard layout toggle

The information you're looking for is stored in the following registry key:

HKEY_CURRENT_USER\Keyboard Layout\Toggle

The key sequence is determined by the Layout Hotkey value:

1 = Left Alt + Shift
2 = Ctrl + Shift
3 = Not assigned
4 = Grave accent

When the value is missing, that means the default setting is being used (i.e. Ctrl + Shift).

References

Related Question