How To Remap Keyboard Keys In Windows (Such as the with Apple Keyboard)

Fri, Jul 2, 2010

Tutorials & Tips

I use the Apple bluetooth wireless keyboard, but I use it with my Windows computer, not a Mac. I love it though, and I think it’s the best bluetooth keyboard around – the problem is, while most keys generally work fine, certain keys are missing.

apple-wireless-keyboard

For instance, on the Apple keyboard, the command key is the Windows key by default, so that’s convenient. However, I don’t have the Home and End keys, which make text-editing cumbersome. Furthermore, I have no Delete key. That sucks, because you can’t even delete a file in Explorer with the keyboard this way. In addition, the keyboard has the left Alt key and the left Windows key completely opposite from my notebook (a Lenovo Thinkpad T410s).

So I went about looking for a solution, and found it in the form of AutoHotKey. It’s a free, open-source utility for Windows that enables you to create scripts for automating keystrokes and mouse clicks. What’s important though, is that it allows you to remap keys as well.

I chose this solution over SharpKeys (another key re-mapping utility) primarily because AutoHotKey allows for “profiles”, which is useful because sometimes I use my notebook alone without my external keyboard, and I want the default key mappings to be restored. With AutoHotKey, I just run a script that remaps the keys that I want, and whenever I’m outside with just my notebook, I disable the script and I’m back to my default key settings.

I had to use a script that was generously given to the community, and modify it to suit my needs. If you’re interested, here it is: AutoHotKey script for Apple Keyboard.

Instructions:

  1. You’ll first need to install AutoHotKey.
  2. Then, download my zip archive (AutoHotKey script for Apple Keyboard), and extract it to wherever you want.
  3. Now, just run the file “Keyboard Media Keys.ahk”.
  4. All set!

Explanation:

What this script does is to remap the eject key on the keyboard to be a Delete key. I’ve also modified some of the Apple keyboard keys to suit me though, and you can change it in the file “Keyboard Media Keys.ahk”. Look for them from line 46-49, and they’ll look like this:

LAlt::LWin
LWin::LAlt
RAlt::End
RWin::Home

So what that means is that I’ve swapped the positions of the left Alt key and the left Windows key. I’ve also set the right Alt key to be End and the right Windows key to be Home.

Hope you find this useful and let me know if you need further help with it!

Similar Posts:

Share and Enjoy!

Find this information useful or entertaining? Share it to the rest of the world!
  • Digg
  • del.icio.us
  • Facebook
  • StumbleUpon
  • Technorati
  • Twitter
  • FriendFeed
  • Reddit
, , , , , , , , , , , , , , , , , , , , , , , , ,

This post was written by:

Alvin - Alvin is a Singaporean who's interested in marketing, techy stuff and likes to just figure out how the two can work with each other. On top of his blog, you can also follow him on Twitter.

Get Alvin's Report On How To Blog Successfully - Free!

  • Brendon
    Hi Alvin, I'm trying to capitalise on your great info here. I've downloaded the current AutoHotKey installer plus your zip archive and extracted it, but when I try to open the file “Keyboard Media Keys.ahk” I get these pop-up messages; "The program can't star because MFC71.DLL is missing from your computer." followed by "RegisterDevice failed. Errorcode: -3".
    I'm running Win 7 on Bootcamp not that that probably makes any difference. Could you tell me what I'm doing wrong please? Thanks, Brendon
  • MFC71.DLL's part of windows, so it looks like it can't be found. I suggest googling for that, and downloading the dll from a reputable download site (because of the inherent risks of installing a dubious DLL).
  • JoseROrtiz
    Awesome script! This is exactly what I needed! I'm encountering an issue when trying to move through the Alt+Tab menu though. The Alt+Tab menu comes up, but once I tab to the application I want to bring up, the Alt+Tab pop-up stays there. Have you had this issue?
  • Yep same here. Unfortunately it turns out to be a specific Alt-Tab behaviour in Windows that doesn't seem to have a solution from what I've searched (it doesn't affect other hot-key combinations). So what I do is Alt-Tab, Enter (to choose the app), and Alt once (to toggle Alt off, because it somehow stays on)
  • Anon
    Hi, Can't seem to get remap of Mac Eject to Windows Backspace and Mac Delete to Windows Delete to work with the native keyboard of teh Macbook Pro 17' latest model. any thoughts? Thanks,.
  • Mine's an external keyboard but it's strange because theoretically the key codes should be the same (I don't have a MBP to test though). Are you trying with AutoHotKey?
  • Anon
    Yes, used AutoHotKey and the following your instructions above for installation and scripts. one would think it would be the same.
    Seems to work for serttings: Keyboard Media Keys.ahk
    But not for: Keyboard Media Keys Actions.ahk
    Perhaps it is checking the wrong code
    Trying to Remap Apple's Eject ==> Windows Delete and Apple's Delete ==> Windows Backspace.
    thanks for your help
  • Ahh...check the instructions.txt file in the package. You probably need to run "Keyboard Media Keys - detect keys.ahk" for your keyboard. See if it says that the Eject key gives you a value of 4854. If it doesn't, you'll need to edit Keyboard Media Keys Actions.ahk with the right value number.
  • Anon
    eject seems to be a special key. i cannot get it to pop a code. also this seems to indicate it's special as well.
    http://discussions.apple.com/message.jspa?messageID=6984033
  • Yes it's a special key, and the original author of the guide put in the DLL just to detect keys like that. I'm not sure why it doesn't appear for MBP keyboards though, and I apologise that I can't test it because I don't have a MBP. However, if it's helpful, I'm using it with the external Apple keyboard, and that works well.
  • Anon
    OK Thanks for all your help and will find another solution. or deal with it... When i run AutoHotkeyRemoteControlDLL.ahk and it lists a bunch of HID, MICE and Keyboards (2 e.g. when i have 1). and when i click on either in the list, i get an error and it crashes. Perhaps the DLL is old and not Win 7 compatible. anyway. thansk so much for your kind attention. And for letting me know it works for you. I will try with a wireless apple keyboard.
  • No problem! :) Actually I'm using Win 7 64bit too, so it's strange - the only thing I can think of is that the MBP keyboard is somehow giving different values, or that the autohotkey program cannot interface it through the Mac...*shrug* Well, hope you find out why...these things can be annoying sometimes!
blog comments powered by Disqus