AutoHotKey is pretty awesome and it's been featured a bunch over the years on Lifehacker.

It's a great tool for automating repetitive tasks in Windows. One repetitive task that has been annoying the heck out of me recently revolves around switching between my headset, which I use for games, skype/hangouts, and conference calls. I generally, though don't have them on while not on a call and so switching back to the main speakers for music and whatnot means I'm constantly going here:

This window is annoying and I wished there were a way of creating a button that I could press or hotkey that I could use that would switch between the two enabled playback devices. Something like this:

Enter: AutoHotKey. AHK user Lexikos wrote a library of AHK functions called "Vista Audio Control Functions " (not Vista specific) that make it easy for a script to do a number of things, including switching between two devices.



I followed the suggestions of some of the users in this forum to create a script that has a taskbar notification icon that changes from a little headphone to a little speaker based on which is active. Here's what my final script looks like:

#include VA.ahk ;VA.ahk has to be in the same folder as this script #Persistent ;this keeps the script running if no hotkeys are set (though one is) ;SETS THE TRAY ICON, ADDS AN OPTION TO RUN THE SCRIPT FROM THE TRAY Menu, Tray, Icon, speak.ico,,1 ;default is speaker icon Menu, Tray, NoStandard ;? Menu, Tray, Add, &Switch Playback Device, #h ;add tray option Menu, Tray, Add, ;add blank line Menu, Tray, Standard ;? Menu, Tray, Default, &Switch Playback Device ;default option is new option Return ;TOGGLE HEADPHONES AND SPEAKERS (if those are the only 2 playback devices enabled) #h:: ;Win+h toggles headphones / speakers Toggle := !Toggle VA_SetDefaultEndpoint("playback:" (Toggle ? 1 : 2), 0) if (Toggle) { Menu, Tray, Icon, head.ico,,1 } else { Menu, Tray, Icon, speak.ico,,1 } return

Some notes on the script:

  1. The VA.ahk (from the Vista Audio Control Functions download) has to be in the same folder as the script.
  2. The icons also are in the same folder as the script, which are named "head.ico" and "speak.ico" (the ones I used are found here and here). These are optional, you can remove them by removing those parts from the script above.
  3. The hotkey is Win+H (#h in AHK notation), but the script is also triggered by double-clicking the notification icon in the taskbar.
  4. If you want to get this to run at startup, you'll need to make a shortcut and put it in your "%AppData%\Microsoft\Windows\Start Menu\Programs\Startup" folder. More on this. You will wanto run the script as an administrator.

EDIT: User SmaalinFrance has shared a standalone tool called SoundSwitch that does this out of the box. I haven't played with it, but it's something that I must have missed while researching ways to fix my annoyance. I'd suggest those that don't want to deal with AHK to check it out. I'm going to stick with AHK because this is not the only hotkey I have setup.