1. Home
  2. Windows Tips
  3. Remap special keys on a keyboard on windows 10

How to remap special keys on a keyboard on Windows 10

External keyboards, both wired and wireless, often have special keys. These keys are separate from the function set of keys that are standard on all laptops. The number and function of these special keys vary from keyboard to keyboard but generally, they let you open your default browser, mail app, the calculator, and they let you control media playback. You’ll find most of these keys to be useful but there will be exceptions. If you’d like to remap special keys on your keyboard, the process is going to be a little complicated but still do-able. As always, we’re using AutoHotKey to get the job done.

Identify key event

The problem with remapping these special keys on a keyboard is that often, they are not recognized by most key identifying apps. We tested a Logitech keyboard out with Sharpkeys and it was unable to identify the ‘Mail’ key on it. When a key cannot be identified, it cannot be remapped. You will find that these keys also do not have a virtual key (vk) code or a scancode (sc). So, to tackle this problem, we’re going to focus on what the key does, rather than its code.

When these keys are pressed, they execute an event. These events are easily recognized by AutoHotKey and can be remapped. To find the event for a particular key, visit Keycode and tap the key that you want to identify the event for. In the screenshot below, you can see the event that is run when I press the Mail key is ‘LaunchMail’.

Note: You can probably guess what event a key runs based on what it does but to eliminate any chances of error, we recommend using Keycode to be sure.

The ‘LaunchMail’ event, by this name, will not be recognized by AHK. You need to figure out how AHK sees this event.

This means little more than looking up the correct name of the event in a table. The table you need to go through is available on the Microsoft Developer Network. Look through this list of virtual key codes until you find the one that corresponds to the event that Keycode recognized. The mail value is called ‘VK_LAUNCH_MAIL’. Find your code, and remove the VK_ before it.

Create AutoHotKey Script

Use the template below to create a script for remapping the special key. You can remap the key to some other key, or you can use it to open a different app. The two examples show you how to do both. Read our guide on mapping common keys in AHK.

Syntax

VK value::Enter

Example 1

Launch_Mail:: Enter

Syntax

VK value::
run "path to app EXE"
Return

Example 2

Launch_Mail::
Run notepad.exe
Return

Paste this in a Notepad file, give it a good name that tells you what the script is for, and save it with the AHK file extension. Run the script. The one I created allows me to open Notepad whenever I tap the special ‘Mail’ key on my keyboard.

You can add the script to your Startup folder and it will run when you boot to your desktop.

3 Comments

  1. My keyboard makes me press the Fn Key to use any of the function keys. I’d like to reverse a couple of the Fn keys so that there would not be a need to press Fn if I want, for example, F5. Can I remap that F key so that when I press on it is the F5 key?

  2. Hey, great tutorial you have here, thank you for your effort!
    What about the “sleep” key ? It doesn’t get detected on the keycode website..
    I want to remap it to something else, but don’t know its VK.
    Thanks!