Jump to content



Photo

[Solved] Logitech Keyboard Buttons / Detecting System Mute


  • Please log in to reply
4 replies to this topic

#1 IanN1990

IanN1990

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 529 posts

Posted 29 June 2012 - 09:17 AM

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, 08 September 2012 - 06:43 PM.








#2 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,729 posts

Posted 29 June 2012 - 02:18 PM

You can try something like this.

AutoIt         
;~ 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 EndIf 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 *newYahtzee 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

#3 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,383 posts

Posted 29 June 2012 - 02:50 PM

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, 29 June 2012 - 02:52 PM.

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

#4 IanN1990

IanN1990

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 529 posts

Posted 29 June 2012 - 04:52 PM

@Xenobiologist
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, 29 June 2012 - 04:54 PM.


#5 IanN1990

IanN1990

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 529 posts

Posted 29 June 2012 - 06:39 PM

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 ?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users