Change audio output Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
carks
Posts: 5
Joined: 01 Jun 2018, 20:41

Change audio output

01 Jun 2018, 20:50

Is there anyway to make a hotkey to change my audio output? I have multiple connections on my PC and it feels tiresome to change everytime.
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: Change audio output

02 Jun 2018, 01:40

is that a "I want a AHK script to switch audio output device" question...
It takes 3 clicks to switch audio device in windows 10. no sure what would be advantageous to have a hot key...
Speaker Tray->Device Drop Down above the volume->Device You want
User avatar
Nextron
Posts: 1148
Joined: 01 Oct 2013, 08:23
Location: Netherlands OS: Win7 x64 AHK: Unicode x32

Re: Change audio output

02 Jun 2018, 09:11

I rather use a hotkey too, my work laptop has an easily accessible mute button, which on double tap I use to switch output.
Using: https://autohotkey.com/board/topic/2198 ... functions/
and grabbing the device names from: mmsys.cpl
call: VA_CycleDefaultEndPoint(["Speakers","Headset","Beamer"])
The more I know:
The more I know,
I know nothing.
User avatar
Flipeador
Posts: 866
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Change audio output

02 Jun 2018, 10:17

Tested on WIN_10 ;)

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus


Note: This method is not documented and may not work in future Windows updates.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
carks
Posts: 5
Joined: 01 Jun 2018, 20:41

Re: Change audio output

02 Jun 2018, 11:53

Flipeador wrote:Tested on WIN_10 ;)

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus



So I just run this as a normal ahk script and it will prompt to change the audio output, right?
User avatar
Flipeador
Posts: 866
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Change audio output

02 Jun 2018, 11:58

So I just run this as a normal ahk script and it will prompt to change the audio output, right?

Yes, a window appears where you have to select the device you want to set as default (you only have to put the number indicated in parentheses). Obviously, this can be adapted to establish a device automatically without asking anything, it is just an example so you can see how it is done.

If it does not work for you, try running the script as Administrator. If it still does not work for you, please comment with the information that appears on the InputBox and the two MsgBox.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
carks
Posts: 5
Joined: 01 Jun 2018, 20:41

Re: Change audio output

02 Jun 2018, 12:04

Ahh, this works perfectly.I would prefer it to just change to an specific audio output but this way totally works in my workflow. Thanks! Although, a little problem I found, is that after entering the value shows up two boxes. i can hide them in the code by commenting them out, is it fine?
User avatar
Flipeador
Posts: 866
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Change audio output

02 Jun 2018, 12:14

a little problem I found, is that after entering the value shows up two boxes. i can hide them in the code by commenting them out, is it fine?

Yes, you can remove/comment them.
Both messages are correct. The first one shows you the identifier of the selected device, and the second one shows you an error code, 0x00000000 is S_OK (success).

Ahh, this works perfectly.I would prefer it to just change to an specific audio output but this way totally works in my workflow

You can set it without asking, tell me the name of the device and I'll tell you how to do it.
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
carks
Posts: 5
Joined: 01 Jun 2018, 20:41

Re: Change audio output

02 Jun 2018, 12:27

I have 5 devices connected, and I use primary 3 of them.

  • AMD HDMI Output
  • Headphones
  • Speakers
User avatar
Flipeador
Posts: 866
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Change audio output  Topic is solved

02 Jun 2018, 12:38

Use F1, F2 and F3.

Code: [Select all] [Expand] [Download] (Untitled.ahk)GeSHi © Codebox Plus

Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina SublimeText 3 & AHKv2
carks
Posts: 5
Joined: 01 Jun 2018, 20:41

Re: Change audio output

02 Jun 2018, 13:05

It works flawlessly, thanks!

Return to “Ask For Help”

Who is online

Users browsing this forum: DhanBB, jnkettenring, RyanAyton and 43 guests