Based on one great script I found in this forum, MUkoTE mutes sound when a window title contains any text pattern defined by user. It unmutes sound when the window changes its title or gets closed. It behaves as expected with all streaming software. Here is the compiled version:
http://cosechapropia.blogspot.com/2009/06/mukote-100.htmlHope you enjoy it!
Code:
;;;;
;;;; MUkoTE
;;;;
;;;; AutoHotKey Script
;;;;
;;;; Kote - j.guevara.a (at) gmail (dot) com - 18/06/2009
;;;;
#SingleInstance Force
SetTitleMatchMode, 2
AutoTrim, On
IniRead, ApplicationName, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, ApplicationName, YouTube
IniRead, Delimiters, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, Delimiters, -
IniRead, FieldNumber, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, FieldNumber, 2
IniRead, PlayButtonSignal, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, PlayButtonSignal, No
Gosub, LoadPatterns
#Persistent
SetTimer, BlockOrNot, 500
^s::
{
Gosub, Configure
Return
}
^m::
{
Gosub, AppendPattern
Return
}
^e::
{
Gosub, EditPatterns
Return
}
Return
;;;;
;;;; Configure Subrutine
;;;;
Configure:
{
InputBox, ApplicationName, MUkoTE Set Parameters, Enter the name of the application you want to control, , ,151 , , , , , %ApplicationName%
IniWrite, %ApplicationName%, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, ApplicationName
InputBox, Delimiters, MUkoTE Set Parameters, Enter the delimiter characters that separates the different sections in the window title. Remember that em-dash (long –) is get with ALT+0150, , ,151, , , , , %Delimiters%
IniWrite, %Delimiters%, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, Delimiters
InputBox, FieldNumber, MUkoTE Set Parameters, Enter the section number you want to get from the window title and append to mute list, , ,151 , , , , , %FieldNumber%
IniWrite, %FieldNumber%, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, FieldNumber
InputBox, PlayButtonSignal, MUkoTE Set Parameters, Do you want to send a Play button signal to %ApplicationName% after mute?, , ,151 , , , , , %PlayButtonSignal%
IniWrite, %PlayButtonSignal%, %A_ScriptDir%\MUkoTE Parameters.ini, MUkoTE, PlayButtonSignal
}
Return
;;;;
;;;; LoadPatterns Subrutine
;;;;
LoadPatterns:
{
PatternCount = 0
Loop, Read, %A_ScriptDir%\MUkoTE Mute List.txt
{
PatternCount += 1
Pattern%PatternCount% := A_LoopReadLine
}
}
Return
;;;;
;;;; AppendPattern Subrutine
;;;;
AppendPattern:
{
WinGetTitle, Title, %ApplicationName%
StringSplit, NewPattern, Title, %Delimiters%
NewPatternSelected = % NewPattern%FieldNumber%
NewPatternTrimmed = %NewPatternSelected%
if NewPatternTrimmed <>
{
FileAppend, `n%NewPatternTrimmed%, %A_ScriptDir%\MUkoTE Mute List.txt
Gosub, LoadPatterns
}
}
Return
;;;;
;;;; EditPatterns Subrutine
;;;;
EditPatterns:
{
RunWait, notepad.exe %A_ScriptDir%\MUkoTE Mute List.txt
Gosub, LoadPatterns
}
Return
;;;;
;;;; BlockOrNot Subrutine
;;;;
BlockOrNot:
{
MuteCondition = No
IfWinExist % ApplicationName
{
Loop %PatternCount%
{
IfWinExist % Pattern%A_Index%
{
MuteCondition = Yes
}
}
}
SoundGet, MasterMute, , Mute
If MuteCondition = Yes
{
If MasterMute = Off
{
SoundSet, 1, , Mute
If PlayButtonSignal = Yes
{
Sleep, 150
Send, {Media_Play_Pause}
}
}
}
Else
{
If MasterMute = On
{
SoundSet, 0, , Mute
}
}
}