Switch between Playback Devices on Windows using a hotkey

I got my windows machine hooked up both to my work station, which means an LCD and regular speakers, and to my TV. When I play something on my TV, I want my sound to go through the HDMI and play from my TV speakers. Now, the way to do this is on most windows versions is to right click your speaker icon in the taskbar, choose Playback Devices, and mark your TV as the Default Playback Device. Vice versa when you want to switch back to your PC speakers.

This isn’t very comfortable if you’re sitting on your couch 🙂

AutoHotKey to the rescue!

What you wanna do is:

1) Install AutoHotKey (http://www.autohotkey.com/)

2) Open notepad, copy paste the following code into it and save it as an .ahk file:

ScrollLock::
toggle:=!toggle ;toggles up and down states.
Run, mmsys.cpl
WinWait,Sound ; Change “Sound” to the name of the window in your local language
if toggle
ControlSend,SysListView321,{Down 1} ; This number selects the matching audio device in the list, change it accordingly
Else
ControlSend,SysListView321,{Down 2} ; This number selects the matching audio device in the list, change it accordingly
ControlClick,&Set Default ; Change “&Set Default” to the name of the button in your local language
ControlClick,OK
return

(You’ll notice I used the ScrollLock key as the hotkey. You’re welcome to change it to whatever you like obviously)

3) Double click the .ahk file. This will enable it until your next restart (probably need to autorun it at startup for convenience. Never got around to doing it since I so rarely restart my machine).

4) Double click on ScrollLock and watch the magic happen 🙂

 

Enjoy!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: