Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@mistic100
Last active February 10, 2024 10:26
Show Gist options
  • Star 97 You must be signed in to star a gist
  • Fork 19 You must be signed in to fork a gist
  • Save mistic100/d3c0c1eb63fb7e4ee545 to your computer and use it in GitHub Desktop.
Save mistic100/d3c0c1eb63fb7e4ee545 to your computer and use it in GitHub Desktop.
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}
@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

@McBruno712
Copy link

Similar but using WASD and M:

; AutoHotkey Media Keys
>^>+Space::Send       {Media_Play_Pause} ; RCtrl + RShift + Space
>^>+A::Send           {Media_Prev}       ; RCtrl + RShift + A
>^>+D::Send           {Media_Next}       ; RCtrl + RShift + D
>^>+M::Send           {Volume_Mute}      ; RCtrl + RShift + M
>^>+W::Send           {Volume_Up}        ; RCtrl + RShift + W
>^>+S::Send           {Volume_Down}      ; RCtrl + RShift + S

@kanyeceejayA
Copy link

I'm curious, do these work with AHk version 2

@zal-ua
Copy link

zal-ua commented Jul 31, 2023

I am trying to use this script in Autohotkey version 2:

Error: Missing "propertyname:" in object literal.

094: }
098: {

▶ 098: Send( {Media_Play_Pause})
098: }
099: {

I'm curious, do these work with AHk version 2
Looks like no. I hope somebody will advise how to fix that. Otherwise I'll have to revert to Autohotkey v1x

@brunohl91
Copy link

brunohl91 commented Aug 7, 2023

@zal-ua , here I resolved with:
Send "{Media_Play_Pause}"

@iki
Copy link

iki commented Feb 10, 2024

Thanks, works great

Updated bindings for Ctrl + Alt + [space, up, down, left, right, .] -> play-pause, volume-up, volume-down, media-prev, media-next, mute

; Media keys
; Ctrl + Alt + [space, up, down, left, right, .] -> play-pause, volume-up, volume-down, media-prev, media-next, mute
<^<!Space::Send {Media_Play_Pause}
<^<!Up::Send    {Volume_Up}
<^<!Down::Send  {Volume_Down}
<^<!Left::Send  {Media_Prev}
<^<!Right::Send {Media_Next}
<^<!.::Send     {Volume_Mute}

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