I'm looking for a way, tool or command line, to mute sound that doesn't come from the focused window.

I'm looking for a way, tool or command line, to mute sound that doesn't come from the focused window.

I have an application that I have to start 4 times. Each window has the same name so I change the Window title to Alpha, Bravo, Charlie and Delta.
All these windows make sound (chat) and I can mute them separately in the windows playback mixer or nearly any tool that manages sound levels in Windows 10.

What I am looking for is a way to mute all windows except the one that has focus. The windows cannot be identified by application name because it is 4 times the same.

For a command line this would be an example (switching is done via script because more actions has to be taken care of):
whatevercommand mute Alpha
whatevercommand unmute Beta

The probably best tool would be the one that detects a window title change of the focused window and mutes what isn't focused and only unmute the active one.

I have spend 3 days on the Internet to search for a good solution but can't find one.

Who can help a searching soul?
Thanks in advance
Who is Participating?
FilipsFreelancerAuthor Commented:
I have searched again and finally found a solution. Not ideal but working. It is based on a Windows system file called sndvol.exe (which is the Windows sound mixer). It searches control by control to see if the text of the window title matches and set a value.

I include the AutoIT code here for those who are searching too:

#include <GuiConstantsEx.au3>
#include <GuiSlider.au3>

Func WinSetVolume($targetTitle, $targetVolume = "toggle")
    Const $localized = "Mute for "
    $currentActive = WinGetHandle("[active]")
    $mixerPid = Run(@SystemDir & "\SndVol.exe -r", "", @SW_HIDE)
    $mixerHandle = WinWaitActive("[CLASS:#32770]")

    $iSlider = 1
    $iButton = 2

    While 1
        $currentButton = ControlGetText("[CLASS:#32770]", "", "[CLASS:ToolbarWindow32; INSTANCE:" & $iButton & "]")
        If @error Then
            Return 0
        ElseIf $currentButton = "" Then ;this ElseIf prevents infinite loop if no matching $targetTitle
            Return 0
        ElseIf StringInStr($currentButton, $localized & $targetTitle, 1) = 1 Then
            If NOT ($targetVolume == "toggle") Then
                $sliderHandle = ControlGetHandle("[CLASS:#32770]", "", "[CLASS:msctls_trackbar32; INSTANCE:" & $iSlider & "]")
                If IsInt($targetVolume) Then
                    $setVolume = -($targetVolume-100)
                    $setVolume = _GUICtrlSlider_GetPos($sliderHandle)
                If $setVolume < 100 Then
                    _GUICtrlSlider_SetPos($sliderHandle, $setVolume+1)
                    ControlSend("[CLASS:#32770]", "", "[CLASS:msctls_trackbar32; INSTANCE:" & $iSlider & "]", "{UP}")
                    _GUICtrlSlider_SetPos($sliderHandle, $setVolume-1)
                    ControlSend("[CLASS:#32770]", "", "[CLASS:msctls_trackbar32; INSTANCE:" & $iSlider & "]", "{DOWN}")
            If $targetVolume == "toggle" OR $targetVolume == "mute" Then ControlCommand("[CLASS:#32770]", "", "[CLASS:ToolbarWindow32; INSTANCE:" & $iButton & "]", "SendCommandID", 305)

            Return 1


        $iSlider += 1
        $iButton += 2


I know your looking for command line way. I don't think that is possible.

I suggest giving sound volume view a try. You can mute anything it detects within the 1 window.
FilipsFreelancerAuthor Commented:
Hi joinaunion,

This was a good tip but no joy :(  That is one of the tools I tried and even wrote an e-mail to Nirsoft to ask if this could be done. Tha answer was no. I was a good idea as a new feature thou.

Can you think about something else?

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Sorry. Are these web sites that you want to mute?
FilipsFreelancerAuthor Commented:
No, these are chat applications. I have to start a program, a so called launcher. There you login and start an other program. If you are in the launcher, you can login with another name and start (the same program) again. Result is 2 windows with the same content but different sound.
And that 4 times. The program that is started in the launcher (as the launcher itself) are all .exe files.

Hope this helps a little.
FilipsFreelancerAuthor Commented:
See my last comment
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.