Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

MUkoTE: Mutes sound when window title matches text patterns


  • Please log in to reply
20 replies to this topic
Kote
  • Guests
  • Last active:
  • Joined: --
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...mukote-100.htmlHope you enjoy it!
;;;;

;;;; 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

  }

 }

}


Kote
  • Guests
  • Last active:
  • Joined: --
USAGE

CTRL+s to set parameters.
CTRL+m to add a text pattern to the mute list.
CTRL+e to edit the mute list.


UNDERSTANDING HOW DOES IT WORK

1. Run MUkoTE making double click on the desktop icon.
2. Press CTRL+s to see default parameters.
3. Press CTRL+e to see default mute list.
4. Click [X] to close mute list.
5. Click on the following link: .
6. Notice that sound gets muted.
7. Notice that MUkoTE needs the controlled application (in this example, the web browser) to be opened or minimized, but it doesn’t work if it is minimized to only an icon next to the system clock.
8. Click on the following link: .
9. Notice that sound gets unmuted.
10. Press CTRL+m to add a new text pattern to the mute list.
11. Click again on the second link ().
12. Notice this time sound gets muted.
13. Press CTRL+e to see mute list again.
14. Click [X] to close mute list.


SYSTEM REQUIREMENTS

Works in Microsoft Windows 95 and compatible operating systems, but Vista users must:
1. Right click on C:\Program Files\MUkoTE\MUkoTE.exe file.
2. Go to Compatibility Mode tab.
3. Check Run this program in compatibility mode checkbox.
4. Select Windows XP (Service Pack 2) option.
5. Click on OK button.

Robert G.
  • Guests
  • Last active:
  • Joined: --
And it avoids ads in Spotify! You have to use these parameters: Spotify, – (em-dash, ALT+0150), 1, Yes.

mrgnome
  • Guests
  • Last active:
  • Joined: --
The mute should mute the soundcard not Spotify. Spotify doesnt recognize a soundcard mute, and does not pause the ads then.

Robert G.
  • Guests
  • Last active:
  • Joined: --
Hi mrgnome! In my tests, when I mute the global sound output, Spotify gets paused. The script, with the parameters above, works right for me. :wink:

Kote
  • Guests
  • Last active:
  • Joined: --
New release (MUkoTE 1.1) with a lot of new features.
http://cosechapropia.../mukote-11.html
- Simplified configuration: just select the program you want to control.
- Mouse control: double click on MUkoTE system tray icon to mute.
- Now it also works when controlled program is hidden.
- User can change mute list path: several users can share the same mute list.
And many more...

bazoomajoe
  • Guests
  • Last active:
  • Joined: --
finally got the hang of this program - you have answered my prayers! many thanks

daorc
  • Members
  • 177 posts
  • Last active:
  • Joined: 18 Oct 2006
For those using this script for Spotify:

While it is tempting to bypass the adverts, if everyone does it Spotify will lose their income. They've done a fantastic thing allowing a lot of people to legally listen to music for free that they would have otherwise illegally downloaded. Isn't it fair enough to pay them by listening to their ads (or even by paying them £10). Muting the spotify ads is morally equivalent to illegally downloading the music in the first place, so why bother getting Spotify if you're going to do that?!

mrgnome
  • Guests
  • Last active:
  • Joined: --

Hi mrgnome! In my tests, when I mute the global sound output, Spotify gets paused. The script, with the parameters above, works right for me. :wink:


I can't get it to work. It just pauses spotify when it mutes. i'm using breakaway audio processor, and i double click it's icon to mute. Spotify doesnt realize this. But i have to do it manually.

mrgnome
  • Guests
  • Last active:
  • Joined: --

Hi mrgnome! In my tests, when I mute the global sound output, Spotify gets paused. The script, with the parameters above, works right for me. :wink:


I can't get it to work. It just pauses spotify when it mutes. i'm using breakaway audio processor, and i double click it's icon to mute. Spotify doesnt realize this. But i have to do it manually.


Oh, how do I set the parameters in the new version, the ctr-links dont seem to work. it just seems it pauses spotify alltogether, it doesnt change the volume or anything. Does the new version work with spotify?

intestinate
  • Guests
  • Last active:
  • Joined: --
daorc - you are a prick

daorc_
  • Guests
  • Last active:
  • Joined: --
yes i know

willb
  • Guests
  • Last active:
  • Joined: --
kote,
you are a legend, works perfectly!

and 2 all u muppets moaning, spotify still get their £££ when u mute the ads. friggin losers.

intestinate
  • Guests
  • Last active:
  • Joined: --
thats exactly my point. i dont need to hear the ads for spotify to get paid. i never respond to internet ads anyway.so who gives a ...

aj
  • Guests
  • Last active:
  • Joined: --
What OS are you guys on?
I'm running vista and my spotify is paused when muted by mukote 1.1

I'm pretty sure it's something to do with the way vista manages soundcard drivers. It took me a long time to get total recorder to work too.

I'm pretty sure I've done everything that needs to be done. Running in XP SP2 compatibility mode.
Any suggestions?