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
Filips
LVL 6
FilipsFreelancerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

joinaunionCommented:
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.
https://www.nirsoft.net/utils/sound_volume_view.html
0
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?

Thanks
Filips
0
joinaunionCommented:
Sorry. Are these web sites that you want to mute?
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

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.
1
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]")
    WinActivate($currentActive)

    $iSlider = 1
    $iButton = 2

    While 1
        $currentButton = ControlGetText("[CLASS:#32770]", "", "[CLASS:ToolbarWindow32; INSTANCE:" & $iButton & "]")
        If @error Then
            ProcessClose($mixerPid)
            Return 0
        ElseIf $currentButton = "" Then ;this ElseIf prevents infinite loop if no matching $targetTitle
            WinClose($mixerHandle)
            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)
                Else
                    $setVolume = _GUICtrlSlider_GetPos($sliderHandle)
                EndIf
                If $setVolume < 100 Then
                    _GUICtrlSlider_SetPos($sliderHandle, $setVolume+1)
                    ControlSend("[CLASS:#32770]", "", "[CLASS:msctls_trackbar32; INSTANCE:" & $iSlider & "]", "{UP}")
                Else
                    _GUICtrlSlider_SetPos($sliderHandle, $setVolume-1)
                    ControlSend("[CLASS:#32770]", "", "[CLASS:msctls_trackbar32; INSTANCE:" & $iSlider & "]", "{DOWN}")
                EndIf
            EndIf
            If $targetVolume == "toggle" OR $targetVolume == "mute" Then ControlCommand("[CLASS:#32770]", "", "[CLASS:ToolbarWindow32; INSTANCE:" & $iButton & "]", "SendCommandID", 305)

            WinClose($mixerHandle)
            Return 1

        EndIf

        $iSlider += 1
        $iButton += 2

    WEnd

EndFunc
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
FilipsFreelancerAuthor Commented:
See my last comment
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
sound

From novice to tech pro — start learning today.