Introduction: Easily Adjusting the Volume With Hotkeys (Win 7)

Hello there and welcome to my first instructable!
In this instructable I will demonstrate how to adjust the volume with just a hotkey.
I will be doing this in windows 7.

What you will need.

  • Autohotkey [Download Link]
  • A Text Editor. For now since you are just starting with autohotkey the Notepad will do.
This is a very simple app script!

Step 1: Install Autohotkey

Now open the downloaded files and install it normally.

Custom or Express doesn't matter. Just Install it.



Step 2: Determine the Hotkey.


Now determine the hokey you want to adjust the volume.
Example:               
  • Ctrl + ↑ for Volume Up.
  • Ctrl + ↓ for Volume Down.
  • Some other Key for Mute.
On second thought lets use Right Control instead of both controls. You see when we use control both keys are added as hotkeys.
The Second Key is Up. So it will be:

RControl & Up

In autohotkey you have to use ampersand(&) between the two key names if you want  a combination hotkey.
If you dont want to use the ampersand you can use the symbols.


# is Windows Key.
+ is Shift Key.
! is Alt Key.
^ is Control Key.
< or > stands for left or right. Not the arrow keys but Left or Right of the above
mentioned keys. ( <^ is Left Control )



List of Keys [link]

So its either:
RControl & Up or <^Up

Note: It doesn't Necessarily have to be two keys. It can be one key. But it will 
be a bother when you do tasks and have to press the key to do something else. 


Step 3: Open the Editor.

Open your editor. I will be using sciTE4Autohotkey since I use autohotkey pretty often.
If you want to download: [link]

Scite offers special tools and functions and is very easy to use. If you will continue on with scripting with
autohotkey you would definitely want to check it out. 

I use it all the time! :3

Step 4: Scripting!

Lets start scripting.
Add the first line.

#NotrayIcon

So that a tray icon wont be seen.

Now add the hotkey. Remember? We went through this in step 3. 
Oh! And add two colons(:) after it. That is to tell authotkey to run the codes after it when the key is pressed.
If the "~" symbol is present the hotkey will not be hidden from the system.

~RControl & Up::

This is the Volume up hotkey right ? So we send Volume Up.
The "2" is how many levels to move up.

Send {Volume_Up 2}


Now add:

Return

The use I will skip for now.

Now your script will look like this:


~RControl & Up::
Send {Volume_Up 2}
return



Now add the Volume down hotkeys as well.


~RControl & Down::
Send {Volume_Down 2}
return



Now the Mute Hotkey. The only difference is that we will enter "Send {Volume_Mute}".


~RControl & Space::
Send {Volume_Mute}
return



Step 5: Save!

Now the script should look like this:

#NotrayIcon

~RControl & Up::
Send {Volume_Up 2}
return

~RControl & Down::
Send {Volume_Down 2}
return

~RControl & Space::
Send {Volume_Mute}
return


Now goto Save as and Save it as a .ahk file.

Step 6: Add It to Startup!

Now if you want this script to start automatically just copy the script to your startup folder.

C:\Users\%Username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\

If you want the script to start for the current user only. ( Replace %Username% with your username )
else

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\

If you want the script to start for all the users.

OR


Add a Registry Key (For advanced users only.)
-----------------------------------------------------------------

Add A String Value with the directory as the data to
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
f you want the script to start for the current user only.
else 
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
f you want the script to start for all the users.

Step 7: Finishing Off!

Here! I made an awesome version which uses the mouse's scroll.
It will work when the mouse is over the taskbar!
Middle Button( Scroll Press) to Mute!


#NoTrayIcon
WheelUp::
If MouseIsOver("ahk_class Shell_TrayWnd")
    Send {Volume_Up 2}
else
  Send, {WheelUp}
return

WheelDown::
If MouseIsOver("ahk_class Shell_TrayWnd")
    Send {Volume_Down 2}
else
  Send, {WheelDown}
return

~MButton::
If MouseIsOver("ahk_class Shell_TrayWnd")
    Send {Volume_Mute}
return

MouseIsOver(WinTitle) {
    MouseGetPos,,, Win
    return WinExist(WinTitle . " ahk_id " . Win)
}

Enjoy! :)
Menixator