BLOG  ›  2010  ›  2
Autohotkey key remapping
Samstag, 06. Februar 2010, Christoph Ertl

Keyboard layoutIn my last post I used SharpKeys to remap the keyboard layout because of my intensive use of home and end keys. Great deal. Works really fine.
But this solution has one major drawback. At the office I use an external keyboard. In this case  I have the inverse of the annoying keyboard layout.

Changing the keyboard mapping to the current situation with SharpKeys is not a solution as the steps would be

  1. Start SharpKeys
  2. Enter/Remove mapping 1
  3. Enter/Remove mapping 2
  4. Enter/Remove mapping 3
  5. Enter/Remove mapping 4
  6. Write to registry
  7. Logout
  8. Login

It’s takes time, is stupid work and is error prone.

So I started searching again and found the tool called AutoHotkey. This tool supports anything around keystrokes, running macros and many more. And it also provides key remapping. The first intention was to forget the solution with SharpKeys and use AutoHotkey instead. But it’s not that simple.

Pro SharpKeys:

  • The settings are written to the registry.
  • The application doesn’t have to run to get the mapping work.

Pro AutoHotkey:

  • Easy to change settings.

The double remapping solution

The solution that' fits best for me is as follows:

  • Using SharpKeys to remap the keyboard to work best with the keyboard of the notebook. Let’s call it “Device settings”.
    This is the default setting of my device and no application is running to get this mapping done.
  • Using AutoHotkey to remap to original keys when using an external keyboard. Let’s call it “External settings”.
    This mode needs an application to run. With external power supply and a very small footprint this is really no problem.

The Steps to switch to External settings or back to Device settings are:

  1. Start/Stop ExternalKeyboard.ahk

Great, I love it. A little tricky but works really great.

I was really surprised how easy the key remapping was done with an AutoHotkey script. It’s that simple:

Home::PgUp
End::PgDn
PgUp::Home
PgDn::End