#AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 -d #include #include Func _MuteActiveWindow($sTitle = "") If not IsDeclared("sTitle") Or $sTitle = "" Then $sTitle = WinGetTitle("[ACTIVE]") Local $sState = WinGetState($sTitle) If ProcessExists("sndvol.exe") Then ProcessClose ("sndvol.exe") local $hMixerPID = Run("sndvol.exe") local $hMixer = WinHandFromPID($hMixerPID) Local $hButton = StringReplace(GetAllWindowsControls($hMixer, "", $sTitle, "ToolBarWindow32"), " ", "") ControlClick($hMixer, "", $hButton) ProcessClose($hMixerPID) WinSetState($sTitle, "", $sState) WinActivate($sTitle) EndFunc Func GetAllWindowsControls($hCallersWindow, $bOnlyVisible=Default, $sStringIncludes=Default, $sClass=Default) If Not IsHWnd($hCallersWindow) Then ConsoleWrite("$hCallersWindow must be a handle...provided=[" & $hCallersWindow & "]" & @CRLF) Return False EndIf If $bOnlyVisible = Default Then $bOnlyVisible = False If $sStringIncludes = Default Then $sStringIncludes = "" If $sClass = Default Then $sClass = "" $sClassList = WinGetClassList($hCallersWindow) $aClassList = StringSplit($sClassList, @CRLF, 2) _ArraySort($aClassList) _ArrayDelete($aClassList, 0) $iCurrentClass = "" $iCurrentCount = 1 $iTotalCounter = 1 If StringLen($sClass)>0 Then For $i = UBound($aClassList)-1 To 0 Step - 1 If $aClassList[$i]<>$sClass Then _ArrayDelete($aClassList,$i) EndIf Next EndIf For $i = 0 To UBound($aClassList) - 1 If $aClassList[$i] = $iCurrentClass Then $iCurrentCount += 1 Else $iCurrentClass = $aClassList[$i] $iCurrentCount = 1 EndIf $hControl = ControlGetHandle($hCallersWindow, "", "[CLASSNN:" & $iCurrentClass & $iCurrentCount & "]") $text = StringRegExpReplace(ControlGetText($hCallersWindow, "", $hControl), "[\n\r]", "{@CRLF}") $aPos = ControlGetPos($hCallersWindow, "", $hControl) $sControlID = _WinAPI_GetDlgCtrlID($hControl) $bIsVisible = ControlCommand($hCallersWindow, "", $hControl, "IsVisible") If $bOnlyVisible And Not $bIsVisible Then $iTotalCounter += 1 ContinueLoop EndIf If StringLen($sStringIncludes) > 0 Then If Not StringInStr($text, $sStringIncludes) Then $iTotalCounter += 1 ContinueLoop EndIf EndIf If IsArray($aPos) Then If $text <> "" Then Return "[ClassNN:" & StringFormat("%19s", $iCurrentClass & $iCurrentCount) & "]" EndIf If Not WinExists($hCallersWindow) Then ExitLoop $iTotalCounter += 1 Next EndFunc ;==>GetAllWindowsControls Func WinHandFromPID($pid) Local $iSeconds = 0 Do $sWindows = WinList("") For $i = 1 To UBound($sWindows)-1 If (WinGetProcess($sWindows[$i][1]) == $pid) And (BitAND(WinGetState($sWindows[$i][1]), 2)) Then Return $sWindows[$i][1] Next Sleep(1000) $iSeconds += 1 Until $iSeconds == 8 EndFunc