Windows 7 – How to Use Keyboard Mute Button for Speakers Only

audioautomationwindows 7

I have a Microsoft Comfort Curve keyboard (KU-0459). It features a set of buttons for volume control. The interesting one is "mute".

I also have a set of USB speakers (Logitech S-150), and a set of headphones with the usual 3.5 mm green/pink jacks going to my on-board sound card.

I am on Windows 7 Ultimate.

I am able to selectively mute the speakers by going into Control Panel -> Sounds -> Playback tab -> Right click speakers -> Disable. I'm very lazy, and I want all of this "clicking" to be done automatically whenever I press my Keyboard's mute button.

If your answer is "AutoHotkey", it would be very nice if you could supply the .ahk script itself

Best Answer

I have written many AutoHotkey scripts to navigate the Control Panel, so I've got you covered! The following script requires that Show Disabled Devices is on

show disabled devices

and that Speakers is Enabled when starting the script.

Note: in my case, Speakers was the 2nd item in the list, so I set the variable speakers to 2.

speakers


enabled = 0
speakers = 2

Volume_Mute::
{
    enabled := !enabled

    Run, control /name Microsoft.Sound
    WinWaitActive, Sound

    Send, {Down %speakers%} ;Speakers
    Send, +{F10} ;Right click

    if (enabled = 1)
    {
        Send, d ;Disable
    }
    else
    {
        Send, e ;Enable
    }

    WinClose, Sound

    return
}

If you are unfamiliar with AutoHotkey or would like a precompiled version of the script, I can provide one that takes the speaker variabled as a parameter. Just let me know. :)

Related Question