Jump to content
Sign in to follow this  

[Solved] Logitech Keyboard Buttons / Detecting System Mute

Recommended Posts


I have a Logitech Wireless Keyboard MK700, The setpoint software that comes with this keyboard isn't very good "though it does its job, i mainly use autoit for extending the functionality and personality of this device" but i have a problem. It has three buttons, Mute, Vol up and Vol Down. Now for some reason "Mute" on my computer doesn't truly mute the sound, i can still hear like whispers. I can only assume this is down to my speakers having a big-ass amplifier on it *Shrugs*.

During my search of the Autoit forums, i came across a UDF called _W7Sounds.au3 which offers a function to truly mute the system (By remembering the Volume, and then sending it to 0. To unmute it sets the 0 to the original Level).

Now to my question.

I want to bind my logitch "Mute" button to this _W7sounds.au3 but the standard Hotkey{"Volume_Mute"} Doesn't work.

Secondly if it’s the case i can’t bind it for whatever reason, then is there a way to detect when the system has been muted ? "So my code could detect a mute has happened and set to 0".

Edited by IanN1990

Share this post

Link to post
Share on other sites

You can try something like this.

;~ ConsoleWrite(Send('{VOLUME_MUTE}') & @CRLF)
$re = _isMute(1000)
If @error Then ConsoleWrite(@error & @CRLF)
ConsoleWrite($re & @CRLF)
; Function Name: _isMute
; Description:: Check for mute sound
; Parameter(s): ControlID
; Voulme = 1000
; Wave = 2000
; SW-Synthesizer = 3000
; CD-Player = 4000
; Mikrofon = 5000
; Line-In = 6000
; Requirement(s): ---
; Return Value(s): 0 = not muted, 1 = muted, -1 = timeout, -2 = ControlID not found
; Author(s): Thorsten Meger (Xenobiologist)

Func _isMute($opt = 1000)
Local $retVal = 0, $ex = False
If Not WinExists('[CLASS:Volume Control]') Then
Run('sndvol32', '', @SW_HIDE)
$ex = True
If WinWait('[CLASS:Volume Control]', '', 2) = 0 Then Return -1
$retVal = ControlCommand('[CLASS:Volume Control]', '', $opt, 'isChecked')
If @error Then Return -2
If $ex = True Then WinClose('[CLASS:Volume Control]')
Return $retVal
EndFunc ;==>_isMute

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

I use code like this to see if that 'red circle with a line thru it' is present over the speaker icon in my tray. If it is, it simply sends 'volume_mute'. If you use this you'll almost certainly need to adjust the screen coords to look in, and maybe even the color, which is pure red here.

; If Main is muted, un-mute it
PixelSearch(1260, 780, 1275, 790, 0xFF0000)
If Not @error Then Send("{VOLUME_MUTE}")
Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post

Link to post
Share on other sites


While playing music i ran your code, it ouputed -1. I then hit the mute on my keybaord and ran the code again but got -1 :huh: **Edit i removed the comments prevending the send Mute and ran the code twice again (even with Vol Mixer showing) but in both instances the output was -1 :)**

@somdcomputerguy :D Aside from the fact pixelsearch is one of the functions i wish to stay away from most in autoit. In my case the taskbar is normally hidden when not beeing used. "As i toyed with the idea of pixelsearch for detecting when a chat program was flashing".

Edited by IanN1990

Share this post

Link to post
Share on other sites

While looking at the windows speaker application "Volume Mixer".

I noticed for each Speaker icon, it has a tooltip "Mute {Item}" or "Unmute {Item}".

Is there any way for me to capture the text from this tooltip as then i could just have a simple check ?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.