This is a sequel to my first screencast on the same topic. This improved version uses only AutoHotkey to adjust the volume and mute, and it works on Windows XP and Windows 7.
Here’s the screencast. See below for detailed instructions on how to set it up for yourself.
Step 2: Download volume.ahk (shown below) and put it in the Startup folder. To find the Startup folder, click the Start button, then All Programs. Right-click on the Startup folder and click Open.
Step 3: Run volume.ahk by double clicking on it. This is what’s in volume.ahk.
; Volume control (turn master volume up and down with Ctrl-Alt-Up/Down and
; toggle mute with Ctrl-Alt-.)
^!Up::Send {Volume_Up}
^!Down::Send {Volume_Down}
^!.::Send {Volume_Mute}
That’s it. Now you can use these keyboard shortcuts to adjust the volume and toggle mute.
Ctrl-Alt-Up: Increase the volume Ctrl-Alt-Down: Decrease the volume Ctrl-Alt-Period: Mute the volume
Thank you very much. I have been trying to figure it out. Interesting that a period and keypad decimal point are two different things to windows running but ahk seems to ‘see’ them both as a period when typed in the script.
You’re welcome. And that is interesting about the period and the number pad decimal point. It kind of makes sense that they both work, but knowing AHK, I bet there’s a way to distinguish them too.
[...] To translate infrared signals to keyboard commands,[Shawn] decided to base his project off a previous build that used a small program called [...]
Thank you for this script. Volume up and down work, but mute doesn’t work for me. What can I do?
» Comment by Alberto Cabas Vidani on April 16, 2012 @ 2:14 am
@Alberto A quick way to debug the script is to run the Window Spy (on the right-click menu of the AutoHotKey tray icon) to see what happens when you hit the key sequence for mute.
@jimmy When you say it’s not working, what isn’t? Does the AutoHotkey script run without errors? If so, what happens when you use the shortcut? You can right click on the autohotkey script when it’s running and select Window Spy to get more details about what’s going on.
@george That’s the code of volume.ahk you’re seeing. To download it you can either right click on the link and save link as or click on the link normally and then save the page.
Heyup, its working, this is great. But, when I am changing the script and want to use three keys: 1. + 2. - 3. 0 it is not working. I don’t want to use helping keys like Ctrl-Alt. Is it possible?
@Veer You are probably going to regret using normal keys, because it will mean you can’t type a number with a 0, and you won’t be able to type a dash or a plus sign. It’s possible, but a bad idea.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
@Rob I ran your script and it worked fine. Try this script and see if you get message boxes with Up and Down when you hit the shortcut.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!Up::MsgBox, Up ^!Down::MsgBox, Down
Just to clarify, you run the Autohotkey script, then hold down Ctrl+Alt+Up (the arrow key, not on the number pad) or Ctrl+Alt+Down.
Thank you very much. I have been trying to figure it out.
» Comment by Rob on May 20, 2010 @ 3:35 pmInteresting that a period and keypad decimal point are
two different things to windows running but ahk seems to ‘see’
them both as a period when typed in the script.
You’re welcome. And that is interesting about the period and the number pad decimal point. It kind of makes sense that they both work, but knowing AHK, I bet there’s a way to distinguish them too.
» Comment by Dan on May 20, 2010 @ 8:23 pm[...] to adjust the volume with a keyboard shortcut Update: Here’s an easier way to do [...]
» Pingback by How to adjust the volume with a keyboard shortcut on November 14, 2010 @ 1:30 am[...] To translate infrared signals to keyboard commands,[Shawn] decided to base his project off a previous build that used a small program called [...]
» Pingback by Control your PC with a remote - Hack a Day on March 5, 2012 @ 7:53 amThank you for this script. Volume up and down work, but mute doesn’t work for me. What can I do?
» Comment by Alberto Cabas Vidani on April 16, 2012 @ 2:14 am@Alberto A quick way to debug the script is to run the Window Spy (on the right-click menu of the AutoHotKey tray icon) to see what happens when you hit the key sequence for mute.
» Comment by Dan on April 16, 2012 @ 10:16 pmi have been trying to do this but its not working. could i get step by step on what to do
» Comment by jimmy on May 15, 2012 @ 8:00 pm@jimmy When you say it’s not working, what isn’t? Does the AutoHotkey script run without errors? If so, what happens when you use the shortcut? You can right click on the autohotkey script when it’s running and select Window Spy to get more details about what’s going on.
» Comment by Dan on May 15, 2012 @ 8:16 pmThanks, though it makes more sense to me to use page up, page down, and end for it. but then again i forget my Fn key doesn’t work…
» Comment by meltedspades on August 5, 2012 @ 11:20 pm@meltedspades If that works for you, run with it. If I used PageUp and PageDown I’d be adjusting my volume up and down all day
» Comment by Dan on August 5, 2012 @ 11:33 pm[...] http://dan.hersam.com/2010/05/06/mute-and-adjust-volume-with-keyboard-hotkeys/ [...]
» Pingback by Hangerő állítás billentyűzetről « voji's world on August 21, 2012 @ 3:06 pmThis only works if you already have the volume bar up. Why bother at that point?
» Comment by unagieel on September 5, 2012 @ 10:52 am@unagieel It’s a global shortcut – it works whenever you use the keys no matter what you’re doing.
» Comment by Dan on September 6, 2012 @ 2:28 pmawesome! thx very much!
I’ve set my UP/DOWN to use the Plus / Minus keys
^!=::Send {Volume_Up}
» Comment by mr a on September 30, 2012 @ 3:35 pm^!-::Send {Volume_Down}
^!.::Send {Volume_Mute}
Thanks!
that’s great! i’ll start a new era of shortcuts!
everrrrything will be a shortcut soon!

» Comment by mohamed on October 11, 2012 @ 10:14 pm@mohamed You’re welcome and you have my permission to go crazy with shortcuts for everything!
» Comment by Dan on October 11, 2012 @ 10:43 pmhey dude im trying to download volume.ahk but its not downloading? it just goes to another page where the volume shorcuts are listed please help
» Comment by george on January 8, 2013 @ 10:37 pm@george That’s the code of volume.ahk you’re seeing. To download it you can either right click on the link and save link as or click on the link normally and then save the page.
» Comment by Dan on January 9, 2013 @ 10:22 am@dan thanks man worked perfectly
» Comment by george on January 10, 2013 @ 8:43 pmthanks man this was very helpful!!
» Comment by Matt on January 11, 2013 @ 2:35 am@Matt You’re welcome.
» Comment by Dan on January 11, 2013 @ 10:27 am@george Cool!
» Comment by Dan on January 11, 2013 @ 10:46 amThank you so much for this tip/tool.
» Comment by Fernando Lopez on January 22, 2013 @ 6:54 pmI spilt beer on my keyboard and I had to connect my old one with no volume hotkeys
@Fernando I hadn’t even considered that use for this, but I’m glad it helped. Careful with your beer next time
» Comment by Dan on January 22, 2013 @ 9:17 pmThanks for the post. This did the job!
» Comment by Vineeth on January 31, 2013 @ 10:01 amThanks Dan… nice one… you’re the man! Big Help…
» Comment by Nhel on February 10, 2013 @ 7:35 pmI can’t thank you enough! Fortunately, this works in desktop mode of Windows 8.
Thank you!!!
» Comment by TBolt on April 2, 2013 @ 12:33 pm@TBolt That’s great, thanks for letting us know.
» Comment by Dan on April 3, 2013 @ 4:09 pmit dont work
» Comment by hassan on April 7, 2013 @ 10:05 am@hassan Try right-clicking on the Autohotkey tray icon and choosing Window Spy (that will give you more information about what’s happening)
» Comment by Dan on April 8, 2013 @ 12:31 pmHeyup, its working, this is great. But, when I am changing the script and want to use three keys:
» Comment by Veer on April 10, 2013 @ 7:24 am1. +
2. -
3. 0
it is not working. I don’t want to use helping keys like Ctrl-Alt. Is it possible?
@Veer You are probably going to regret using normal keys, because it will mean you can’t type a number with a 0, and you won’t be able to type a dash or a plus sign. It’s possible, but a bad idea.
» Comment by Dan on April 10, 2013 @ 1:01 pmDan, thanks for posting this. Unfortunately, it’s not working for me. I tried using Window Spy to debug, but nothing gets logged. Any ideas?
» Comment by Rob on April 10, 2013 @ 2:58 pm@Rob Could you post the text from your Autohotkey script? I can run it to see what’s going on.
» Comment by Dan on April 10, 2013 @ 3:03 pmDan, sorry for the delay posting this.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!Up::Send {Volume_Up}
» Comment by Rob on April 13, 2013 @ 2:15 pm^!Down::Send {Volume_Down}
@Rob I ran your script and it worked fine. Try this script and see if you get message boxes with Up and Down when you hit the shortcut.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^!Up::MsgBox, Up
^!Down::MsgBox, Down
Just to clarify, you run the Autohotkey script, then hold down Ctrl+Alt+Up (the arrow key, not on the number pad) or Ctrl+Alt+Down.
Let me know how it works.
» Comment by Dan on April 15, 2013 @ 6:03 pmDan, thanks very much! Force of habit, I was using numpad arrow keys vs. navigation keys (duh). I modified the script as follows and it works great.
!NumpadUp::Send {Volume_Up 2}
» Comment by Rob on April 20, 2013 @ 5:41 pm!NumpadDown::Send {Volume_Down 2}