Skip to content

Instantly share code, notes, and snippets.

@mistic100
Last active June 1, 2023 17:00
Embed
What would you like to do?
Media keys shortcuts for AutoHotkey

Media keys shortcuts for AutoHotkey

  • Ctrl + Alt + Space : Pause
  • Ctrl + Alt + Right : Next
  • Ctrl + Alt + Left : Previous
  • Ctrl + Alt + - : Volume down
  • Ctrl + Alt + + : Volume up
  • Ctrl + Alt + * : Mute
; AutoHotkey Media Keys
^!Space::Send {Media_Play_Pause}
^!Left::Send {Media_Prev}
^!Right::Send {Media_Next}
^!NumpadMult::Send {Volume_Mute}
^!NumpadAdd::Send {Volume_Up}
^!NumpadSub::Send {Volume_Down}
@ChrisRoss5
Copy link

Thanks king, however NumpadSub isn't working as my keyboard is registering NumpadSubtract (https://keycode.info/) and AHK doesn't recognize that...?

@Lahiri
Copy link

Lahiri commented Jan 22, 2021

This was very very usefult, thank you so much!
I modified a little bit to fit my setup. I'm leaving it here just in case anyone is interested:

>!>Space::Send      {Media_Play_Pause}      ; AltR + Space
>!>Left::Send       {Media_Prev}            ; AltR + Left
>!>Right::Send      {Media_Next}            ; AltR + Right
>!>Delete::Send     {Volume_Mute}           ; AltR + Delete
>!>Up::Send         {Volume_Up}             ; AltR + Up
>!>Down::Send       {Volume_Down}           ; AltR + Down

@tmuka
Copy link

tmuka commented May 19, 2021

thanks! In case it's helpful, I used this modification on my Thinkpad Trackpoint Keyboard ii which lacked multimedia keys. I don't know why they didn't keep the useful older Fn+arrow key shortcuts they used to have. It seems like it would be an easy firmware update for Lenovo... AutoHotkey to the rescue!

^!Down::Send	{Media_Play_Pause}
^!Up::Send	{Media_Stop}
^!Left::Send	{Media_Prev}
^!Right::Send	{Media_Next}
^!PgUp::Send	{Volume_Up}
^!PgDn::Send	{Volume_Down}

@SuperAadhil
Copy link

Just for those who only need volume control like in a laptop. Hope it helps.

#SingleInstance force

F6::Send	{Volume_Up}
F5::Send	{Volume_Down}

@AmmarHaddadi
Copy link

Just for those who only need volume control like in a laptop. Hope it helps.

#SingleInstance force

F6::Send	{Volume_Up}
F5::Send	{Volume_Down}

aaaaah tnx
the syntax of this language is crazy , couldn't do it my self

@djhurio
Copy link

djhurio commented Apr 28, 2022

Thanks a lot! This is my setting I am using.

^!Insert::Send {Media_Play_Pause}
^!Home::Send   {Media_Prev}
^!End::Send    {Media_Next}
^!PgUp::Send   {Volume_Up}
^!PgDn::Send   {Volume_Down}

@fadisayegh
Copy link

Hi, how can I make a script for media actions to run on dedicated macro keys?

I tried making the script as an exe file but I think the code I used is incorrect?

My Macro keys are f2-f5 and only work if I click the FN button, will that be a problem?

Thanks!

@jparth78
Copy link

jparth78 commented Jan 3, 2023

got the first 3 from a website tutorial and wanted to add the volume keys along with it using 2 key shortcut

thanks for the help

; "CTRL + LEFT" for previous
^Left::Media_Prev

; "CTRL + RIGHT" for next
^Right::Media_Next

; "CTRL + SPACE" for pause
^Space::Media_Play_Pause

; "CTRL + Arrow Down" for Volume Down
^Down:: Volume_Down

; "CTRL + Arrow Up" for Volume Up
^Up:: Volume_Up

; "CTRL + Numpad 0" for Mute
^Numpad0:: Volume_Mute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment