Mapping Keys to Non-Keyboard Functions in Windows

keyboardwindows

I want to map Fn+F2 to < and Fn+F3 to >, and leave all remaining keys intact. And by mapping I mean so that it will actually type those keys, and not just pretend I typed the key labeled <.

Scenario:
I have an English keyboard. I have set the keyboard map to Norwegian, however, now there is no way for me to type < and >, since they are nowhere in that keymap. You see, I am one key short and then something has to go.

With the registry hack that SharpKey uses, I can remap any key on the keyboard to any other key on the keyboard – but that does not help. All you are doing is saying "key number X will be treated as key number Y", and you are back to square one.

With Microsoft Keyboard Layout creator, I can sort of to this, but only with the "non-special" keys. I can not even reassign Caps Lock, which would actually have been sufficient for my purposes.

Is there a way of achieving this? Either mapping Fn+F2 to < and Fn+F3 to >, or mapping caps lock to < and shift+caps lock to > would be fine.

Best Answer

You can accomplish this using AutoHotkey.

Here is a quick script:

File: Signs.ahk

#,::
Send {Asc 060}
return

#.::
Send {Asc 062}
return

When ran, this will allow you to send < and > by simply pressing the following keys:

  • WinKey+, to send a <
  • WinKey+. to send a >

NOTE: You do not need to map it to the WinKey, you can use Ctrl, Alt or any combination of those keys therein. Documentation for that can be found at the following KB article: Send/SendRaw/SendInput/SendPlay

You simply create the file w/ the .ahk extension, and execute it (or Right Click -> Open With... -> AutoHotkey.

This works (I tested it by switching my keyboard layout to ND and testing it. The reason this works is because AutoHotkey can send the ASCII equivalent to the < and > properly to any window that accepts that type of input.

I mapped them that way simply because on the English keyboard, they are on the same keys at those listed, but you can map them to whatever. However, i do notice that F1 through F12 will not work, given that the ND keyboard layout has no idea what those are properly.

Related Question