Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Windows 7, Logitech G110 keyboard

2 audio devices (headphones and speakers)

I am hoping to find a quick way to macro a key to switch to headphones, and a key to switch to speakers.

Anyone have a good program or anything of that nature?

EDIT: Using AHK to try and get this task working as hoped is sadly not doing the trick. I have included a screenshot of my audio set, as well as a screenshot of my script as it sits now. Sound setup Script

I have also tried to uncheck "show disabled devices" and modified the script to be Down 1, and Up 1 respectively. It will work for one device, but it refuses to switch to the secondary.

share|improve this question
3  
Autohotkey hacks: this article or the second post here. If someone has enough time to write one of those up into a full answer, feel free. – Bob May 19 '12 at 5:32
Followed the instructions in those 2 links, still no luck sadly, AHK doesnt seem to like my audio selection choices, and constantly defaults to my Speakers instead of switching between headphones and speakers – francisswest May 19 '12 at 5:57
Well, what are your choices? How about a screenshot, or at least a list? – Bob May 19 '12 at 6:06
@Bob - Sorry about that, I have edited the post with the info requested. – francisswest May 19 '12 at 18:40

1 Answer

up vote 2 down vote accepted

Based off of this article.

  1. Download and install AutoHotkey.

  2. Open your sound control panel. This can also be done through running mmsys.cpl through the start menu search or the run dialog.

  3. Note how far down the list your desired options are. In the following image, the HDMI Output is item 1 and the current default Speakers is item 4.

    Screenshot of sound control panel

  4. Modify the following script. F6 and F7 represent the activation key (F6 and F7) (the * means this hotkey applies even when modifiers such as Ctrl are pressed). The {Down #} command indicates how far down the list to go. From your screenshots, you want {Down 3} for Speakers and {Down 4} for Headset. If you add or remove audio devices, or show/hide disabled items, the number will change.

    *F6::
        Run, mmsys.cpl
        WinWait,Sound
        ControlSend,SysListView321,{Down 3}
        ControlClick,&Set Default
        ControlClick,OK
        return
    
    *F7::
        Run, mmsys.cpl
        WinWait,Sound
        ControlSend,SysListView321,{Down 4}
        ControlClick,&Set Default
        ControlClick,OK
        return
    
  5. Run the script. You can set the script to run at startup if you'd like.


The reason I call this a 'hack' is the script actually opens the control panel (a GUI window). Ideally, this could be done through the command line, by specifying the sound device's GUID.

There's apparently a program with a CLI to switch sound devices. You supply the same number in the list, which makes me think it's not much different from the AutoHotkey 'hack' here. In any case, something like AHK would be required to bind it to a hotkey.

share|improve this answer
You sir, are fantastic. Thank you for the assistance. It is now a functional script! Flagged as the answer, and upvoted. Much appreciated! – francisswest May 19 '12 at 21:23
If you just want to toggle between two outputs, here is an updated script to do that. – MBraedley Nov 22 '12 at 1:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.