Return to Snippet

Revision: 32379
at September 23, 2010 10:44 by harrison3001


Updated Code
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <[email protected]>
;
; Script Function:
;	Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, mmsys.cpl
Sleep, 100
WinWait, Audio ; change ALL Audio references to the corresponding window title of the panel (vary upon different languages)
IfWinNotActive, Audio WinActivate, Audio
WinWaitActive, Audio
Send, {Down}
Sleep, 50
Send, {Down}
Sleep, 50
Send, {Tab}
Sleep, 50
Send, {Enter}
Sleep, 50
Send, {Enter}

Revision: 32378
at September 23, 2010 10:38 by harrison3001


Updated Code
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <[email protected]>
;
; Script Function:
;	Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, mmsys.cpl
Sleep, 100
WinWait, Audio ; change ALL "Audio" references to the corresponding window title of the panel (vary upon different languages)
IfWinNotActive, Audio WinActivate, Audio
WinWaitActive, Audio
Send, {Down}
Sleep, 50
Send, {Down}
Sleep, 50
Send, {Tab}
Sleep, 50
Send, {Enter}
Sleep, 50
Send, {Enter}

Revision: 32377
at September 23, 2010 10:17 by harrison3001


Initial Code
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <[email protected]>
;
; Script Function:
;	Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

Run, mmsys.cpl
Sleep, 100
WinWait, Audio
IfWinNotActive, Audio WinActivate, Audio
WinWaitActive, Audio
Send, {Down}
Sleep, 50
Send, {Down}
Sleep, 50
Send, {Tab}
Sleep, 50
Send, {Enter}
Sleep, 50
Send, {Enter}

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

Initial Description
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.

Initial Title
Switch Windows 7 Audio Device with AutoHotkey (Second Device)

Initial Tags
windows

Initial Language
AutoIt