Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Changing default audio device


  • Please log in to reply
104 replies to this topic
tomchuk
  • Members
  • 2 posts
  • Last active: Feb 17 2012 10:55 PM
  • Joined: 15 Feb 2012

Very nice tomchuk :)
But cycling/^!s:: does nothing on my side.


Looks like I wrote this script on AutoHotkey_L - it's not working for me either on AutoHotkey Basic. I'm a total noob at AHK, if anyone with a little more experience wants to get this working on AHK Basic, I'd certainly appreciate it.

Cragaha
  • Members
  • 265 posts
  • Last active: Jan 04 2016 02:24 AM
  • Joined: 19 Nov 2010
Why is this code not returning anything?

RunWait , %comspec% /c ""EndPointController.exe" >"%A_Scriptdir%\EndPointController.txt"",, Hide
FileRead, Content, %A_Scriptdir%\EndPointController.txt
MsgBox, %Content%
ExitApp

And if I execute it manually it works fine!

Anyone?

borna
  • Guests
  • Last active:
  • Joined: --
I was thinking more of a way to do whatever that linked code does natively AHK_L without calling any external non-AHK script at all apart from from what is bundled with Windows.

  • Guests
  • Last active:
  • Joined: --

I was thinking more of a way to do whatever that linked code does natively AHK_L without calling any external non-AHK script at all apart from from what is bundled with Windows.


That's the spirit :D

mattrb
  • Members
  • 2 posts
  • Last active: Mar 02 2012 06:29 PM
  • Joined: 02 Mar 2012
Hello, this script seemed to be best for me.

I put a window close command at the end.

I tried to do polish Win7 with this script by replacing Sound with Dźwięk. This does not work. Nor does it work on any other Scripts in this thread. I did Unicode and looked at the Netherlands example but still I have no luck. Maybe it does not understand unicode window panes.


Please help with my polish Sound Changer quest.



Here's another approach. Still a little clunky, but this will scroll to the next sound card in Windows 7 and loop back to the top from the bottom. You can uncomment the msgbox toward the end if you want the selected card to be displayed; and/or comment out the SoundPlay line if you don't want an audio alert on the new card.

There is probably a way to make this a little more efficient; ideas welcome.

^+`::
Run,mmsys.cpl
WinWait,Sound
IfWinNotActive,Sound WinActivate,Sound
WinWaitActive,Sound
ControlSend,SysListView321,{PgUp}  
x := 1
ControlGet, isEnabled, Enabled,,&Set Default
ControlGet, max, List, Count, SysListView321
while (isEnabled AND x <= max) {
   ControlSend,SysListView321,{Down}  
   ControlGet, isEnabled, Enabled,,&Set Default
   x := x+1
}
if (x >= max) {
   x := 1
} else {
   x := x+1
}
sleep 50
ControlSend,SysListView321,{PgUp}  
while (x > 1) {
  sleep 50
  ControlSend,SysListView321,{Down}  
  x := x-1
}
ControlGet, Current, List, Selected, SysListView321
; msgbox %Current%
ControlClick,&Set Default
ControlClick,OK
SoundPlay *48

return
[/code]



Cragaha
  • Members
  • 265 posts
  • Last active: Jan 04 2016 02:24 AM
  • Joined: 19 Nov 2010
@mattrb, try this

Posted Image

mattrb
  • Members
  • 2 posts
  • Last active: Mar 02 2012 06:29 PM
  • Joined: 02 Mar 2012

@mattrb, try this


There is a reason why Aziz Anasari is the only Muslim comic. The humor is dry, like your Mohammed.


Please help me with the polish translation.


Thanks.

Cragaha
  • Members
  • 265 posts
  • Last active: Jan 04 2016 02:24 AM
  • Joined: 19 Nov 2010

There is a reason why Aziz Anasari is the only Muslim comic. The humor is dry, like your Mohammed.


Please help me with the polish translation.


Thanks.


Did you even try what i linked?

emmanuel d
  • Members
  • 519 posts
  • Last active: Jul 15 2017 12:04 PM
  • Joined: 29 Jan 2009

Why is this code not returning anything?

RunWait , %comspec% /c""EndPointController.exe" >"%A_Scriptdir%\EndPointController.txt"",, Hide
FileRead, Content, %A_Scriptdir%\EndPointController.txt
MsgBox, %Content%
ExitApp
And if I execute it manually it works fine!
Anyone?

becouse you are ""double quoting"".
you have to quote where there is a space in the filename.
also you need a space in /c"
you need to pay mor attention to details sir, not just try and error.
so you can do:
RunWait , "%comspec%" /c "EndPointController.exe" >"%A_Scriptdir%\EndPointController.txt",, Hide
or:
RunWait , cmd.exe /c "EndPointController.exe" >"%A_Scriptdir%\EndPointController.txt",, Hide

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license

http://www.ahkscript.org/ the new forum


emmanuel d
  • Members
  • 519 posts
  • Last active: Jul 15 2017 12:04 PM
  • Joined: 29 Jan 2009

Did you even try what i linked?

I think he wants a ahk solution, not that executable.
Why else would he be here? :roll:
:lol: :lol:

Stopwatch emdkplayer
the code i post falls under the: WTFYW-WTFPL license

http://www.ahkscript.org/ the new forum


ddlordy
  • Members
  • 12 posts
  • Last active: Jun 13 2012 05:56 AM
  • Joined: 13 Jun 2012
nvm

engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005

saved it in extension .vbs

That would be the issue. This forum is for the AutoHotkey language, so the code should be in a .ahk file. Also be sure to download the language itself from autohotkey.com or l.autohotkey.net for the newer version.

ddlordy
  • Members
  • 12 posts
  • Last active: Jun 13 2012 05:56 AM
  • Joined: 13 Jun 2012
This worked great for me but can someone tell me how to do this for Recording devices as well?

I just updated to windows 7 and needed a toggle version of this script. I mixed and matched what I had with the above posts and came up with this.

This will set the first device active if it isn't already.
If the first device is active then it will activate the 3rd device.

Additionally once a device is picked it plays a sound so you know which device is selected.

^+`::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down}
ControlGet, isEnabled, Enabled,,&Set Default
if(!isEnabled)
{
	ControlSend,SysListView321,{Down 2}
}
ControlClick,&Set Default
ControlClick,OK
WinWaitClose
SoundPlay, *-1
return



engunneer
  • Moderators
  • 9162 posts
  • Last active: Sep 12 2014 10:36 PM
  • Joined: 30 Aug 2005
send different keys
...
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysTabControl321,{Right}
...


ddlordy
  • Members
  • 12 posts
  • Last active: Jun 13 2012 05:56 AM
  • Joined: 13 Jun 2012
The toggling would work at times and sometimes not for Recording Device for Win7. I tried to code this in the same manner as the code for Playback Device for Win7 (which works great) but still no go...help?
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Control down}{Tab}{Control up}
ControlSend,SysListView321,{Down 5}
ControlGet, isEnabled, Enabled,,&Set Default
if(!isEnabled)
{
  ControlSend,SysListView321,{Down 6}
}
ControlClick,&Set Default
ControlClick,OK
WinWaitClose
SoundPlay, *-1
return

; Swap Default Recording Device for Win7

*F5::
    Run, mmsys.cpl
    WinWait,Sound
    ControlSend,SysListView321,{Control down}{Tab}{Control up}
    ControlSend,SysListView321,{Down 5}
    ControlClick,&Set Default
    ControlClick,OK
    return

*F6::
    Run, mmsys.cpl
    WinWait,Sound
    ControlSend,SysListView321,{Control down}{Tab}{Control up}
    ControlSend,SysListView321,{Down 6}
    ControlClick,&Set Default
    ControlClick,OK
    return