Switch Windows 7 Audio Device with AutoHotkey (Second Device)


/ Published in: AutoIt
Save to your folder(s)

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, http://jumplist.gsdn-media.com/site/Main_Page, 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 http://www.autohotkey.com/forum/viewtopic.php?t=2436 at AutoHotkey Community where the same script for XP script resides.


Copy this code and paste it in your HTML
  1. ;
  2. ; AutoHotkey Version: 1.x
  3. ; Language: English
  4. ; Platform: Win9x/NT
  5. ; Author: A.N.Other <[email protected]nowhere.com>
  6. ;
  7. ; Script Function:
  8. ; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
  9. ;
  10.  
  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.
  14.  
  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. Sleep, 50
  20. Sleep, 50
  21. Sleep, 50
  22. Sleep, 50

URL: http://www.autohotkey.com/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.