Sunday 21 July 2019

windows 7 - How to use the keyboard's mute button to mute only the speakers, not the headphones?


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



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. :)


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...