AutoHotkey in user-space Windows

Imagine you are working under MS Windows on a corporate network without super user (aka root or admin) access. And your keyboard has the wrong key placement, e.g. the order of Pos1-PgUp-PgDown-End on the right side is wrangled. What do you do?

Microsoft Sculpt keyboard
Microsoft Sculpt keyboard (2013)

AutoHotkey [docs] comes to the rescue. Linux key mapping is more complex; this is one of the few instances where a Windows app does it better.

Configuration

It works like this: You create a source file with key mappings [keys] [tutorial], run a compiler, and get a small exe that runs in the systray and enforces your mappings.

notepad ms_sculpt_keyb.ahk
    ; Note: in explorer, drop script file on AutoHotkeyU64.exe (Win7, 64-bit).
    #NoEnv                       ; legacy compatibility
    #SingleInstance force        ; automatic reload without warnings
    #Warn                        ; rm: stricter checking
    SendMode Input               ; Recommended for new scripts; better speed and reliability.
    SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
    End::PgUp
    PgUp::PgDn
    PgDn::End
    CapsLock::RAlt
    Insert::Enter

Ahk2Exe.exe /in ms_sculpt_keyb.ahk

... and you get a ms_sculpt_keyb.exe that, when started, manifests in the systray. You can also drop the ahk file onto AutoHotkeyU64.exe for the same effect. Might be necessary to comply to Windows code signing which our new exe certainly will not have.

Bonus Level

Just for illustration, those keyboards were the reason I set out to remap keys:

Sony Vaio S11 keyboard, german Lenovo Yoga 900 keyboard, german MS Sculpt keyboard, german
Sony Vaio S11 [de] (good), Lenovo Yoga 900 [de] (bad), MS Sculpt [de] (bad)

... and now I have the remap, Windows and Linux.

Conclusion

That was it already! You can do much more with AutoHotkey (AHK), explore their documentation if you like. Most of all, have a good day!

EOF (Apr:2021)