How To Assign Media Key Buttons on Windows 10

5

I used to have a keyboard that comes with a set of media key buttons that I can easily use to control my Spotify app on my computer. I didn’t realize that I would miss those key buttons when I switched to a better typing keyboard that doesn’t have any extra function keys. Now that I do and I need to figure out a way to get around it.

image 13 600x316 - How To Assign Media Key Buttons on Windows 10

It turns out not that easy. Remapping keys doesn’t seem to work since they are not the type of keys that you can map to. They are not app-specific either so remapping shortcuts will also not work. As matter of fact, media key buttons don’t send key combinations at all. Instead, they have their own usage IDs in the HID.

After trying a few ways, I ended up with AutoHotkey, the ultimate automation scripting language for Windows. And it works pretty well.

First of all, download and install AutoHotkey on your computer, which is straightforward.

Then, create a new file with the following script and name it as a .ahk file, e.g. media_keys.ahk.

SendMode Input  
SetWorkingDir %A_ScriptDir%  
^!Left::Send   {Media_Prev}
^!Down::Send   {Media_Play_Pause}
^!Right::Send  {Media_Next}
+^!Left::Send  {Volume_Down}
+^!Down::Send  {Volume_Mute}
+^!Right::Send {Volume_Up}
Return

Once saved, double-click it to launch it.

And that’s it. The new control key combinations are:

Ctrl + Alt + Left : Previous
Ctrl + Alt + Right : Next
Ctrl + Alt + Down : Play/Pause
Ctrl + Shift + Alt + Left : Volume Down
Ctrl + Shift + Alt + Right: Volume Up
Ctrl + Shift + Alt + Down : Mute/Unmute

To make it run on every start, right-click on the script file you created and Compile Script, which creates an executable file that you can place into the startup folder like below.

%appdata%\Microsoft\Windows\Start Menu\Programs\Startup
image 14 - How To Assign Media Key Buttons on Windows 10

Was this article Helpful?

Thank you for the feedback!

5 COMMENTS

  1. Hi Kent

    Just a tip for those less familiar with AutoHotKey, if you run the Ahk2Exe.exe app, you can use a GUI to compile the script. This provides a couple of options, including setting a custom icon for the compiled exe, so it looks nice in your system tray.

    As for remapping, have you looked at KeyTweak? I know it’s an older app, but it does work in Windows 10 and has some special media key definitions. It’s basically a handy front-end to edit a registry key that lets you remap keyboard scancodes. Which means a reboot will be required to have the new settings take effect.

    If you use its “Half Teach Mode” you can record any keystroke combination, then map it to the media key of your choosing.

    Might be worth a look.

    • Thanks, Glenn. Great suggestions as always. I am not an avid AutoHotkey user, to be honest. This is the first time I ever tried to use it as I was out of other options. So far, it actually works…lol. I haven’t looked at KeyTweak yet, good mentioning. By the look of it, it might work as well.

    • Sadly KeyTweak can’t do key combinations, since it’s limited by what’s possible with registry edits. So you have to replace the fuctions of 3 of your keys, which is fine if you have useless keys on your keyboard I guess, but the Autohotkey approach is more elegant in my opinion. I bound mine to Right Ctrl + Home/End/Insert. Here’s the code for anyone interested:

      SendMode Input
      SetWorkingDir %A_ScriptDir%
      >!Home::Send {Media_Prev}
      >!End::Send {Media_Play_Pause}
      >!Ins::Send {Media_Next}
      Return

      Also thanks for the compilation tips, for a graphic designer like me the tray icon is important 😀

  2. Please, do explain what the prupose of
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    and the random “return” at the bottom serve.
    Humor me.

LEAVE A REPLY

Please enter your comment!
Please enter your name here