Hand machined mechanical pencils

Mapping the Num Lock key to a comma (31/05/12)

So, you ask, why would I want to do this? Well, I enter a lot of coordinates in my CAD program, and I've always wanted a way of entering them quickly using only the numeric keypad. However, despite the BBC Master 128 having enough foresight to include a comma on the keypad -

     

- modern keyboards lack a comma on the numeric keypad.

My first attempt was to buy an external USB keypad which did have a comma key, or at least appeared to. This was an extremely rare find on EBay, since most external keypads are just like the keypad on a full-size keyboard. It was advertised as "New USB Numeric Keypad Number Key Pad & LED Indicator" from seller "rscommunications". Here's a photo:

     

Look - there's a comma key! I fired up Notepad, and it worked great. I fired up my CAD program, and it didn't work great. My CAD program (Rhino) has a sort of command line where different drawing commands and coordinates are entered, and the comma key simply did not produce anything. Sigh...

I did a little bit of digging with a utility called KeyCodes (http://delphiforfun.org/programs/utilities/KeyCodes.htm). This displays the actual key codes produced by the keyboard. Here's what KeyCodes showed when I pressed the comma key on my USB keypad:

     

What this means is that the USB keypad is simulating a comma by "pressing" Alt and then 44 on the numeric keypad, which is the ASCII code for a comma! The command line in Rhino obviously doesn't like this, and doesn't display anything. Why, when they went to the trouble of simulating three separate key presses, didn't they just simulate a normal comma key?!?

Fortunately, all is not lost. There is a really neat utility called SharpKeys (http://sharpkeys.codeplex.com/) which can map any key to any other key. I needed to find a key which was near my numeric keypad, but which was rarely (if ever) used and could be mapped to a comma. Of course, the Num Lock key itself! Since when did you ever use the arrow and up/down functions on the keypad anyway? So I mapped the Num Lock key to a comma. Unfortunately, the default mode of the keypad keys seems to be the arrow and up/down things, so I needed a Num Lock key to restore the number functionality. So, I mapped Scroll Lock to Num Lock, since Scroll Lock is another key that's hardly ever used (I think it works in Excel, but that's about it). I did try mapping the Alt Gr key, but it isn't recognised by Sharpkeys. Here's a shot of Sharpkeys' settings:

     

End result: a numeric keypad with a comma key, which produces a real comma. It's a little bit odd having to move up to reach the comma key, since the period/decimal point key is down the bottom, but you soon get used to it. It really makes entering lots of coordinates much easier.