Posted By

harrison3001 on 09/23/10


windows audio autohotkey

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Switch Windows 7 Audio Device with AutoHotkey (Second Device)

 / Published in: AutoIt


Be sure to change all Audio references to the corresponding window title in your language. This script switch the default audio device in Windows 7 to the second audio device, in my case the Headphones. You can add one or more Send, {Down} statements, 1 more for your third device, two more for your fourth device, always followed by a reasonable sleep as the script shows. Hope you find it useful. This script can be used in conjunction with Jumplist Extender application,, to easily switch the device from the Windows 7 taskbar as it accepts internally the execution of AutoHotkey scripts. You can easily create a script to revert back to the first audio device, you have to remove a Send, {Down} statement and increase the sleep time a bit more if don\'t work (I don\'t know why). You need AutoHotkey (see the url above) installed to run this script, simply create a file with the extension .ahk and paste the code. AutoHotkey will recognize the registered extension and will run the script. Thanks to procyon at AutoHotkey Community where the same script for XP script resides.

  1. ;
  2. ; AutoHotkey Version: 1.x
  3. ; Language: English
  4. ; Platform: Win9x/NT
  5. ; Author: A.N.Other <[email protected]>
  6. ;
  7. ; Script Function:
  8. ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
  9. ;
  11. #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
  12. SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
  13. SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
  15. Run, mmsys.cpl
  16. Sleep, 100
  17. WinWait, Audio ; change ALL Audio references to the corresponding window title of the panel (vary upon different languages)
  18. IfWinNotActive, Audio WinActivate, Audio
  19. Send, {Down}
  20. Sleep, 50
  21. Send, {Down}
  22. Sleep, 50
  23. Send, {Tab}
  24. Sleep, 50
  25. Send, {Enter}
  26. Sleep, 50
  27. Send, {Enter}

Report this snippet  

You need to login to post a comment.