AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

MUkoTE: Mutes sound when window title matches text patterns
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Kote
Guest





PostPosted: Sun Jun 28, 2009 4:44 pm    Post subject: MUkoTE: Mutes sound when window title matches text patterns Reply with quote

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
  }
 }
}
Back to top
Kote
Guest





PostPosted: Sun Jun 28, 2009 4:50 pm    Post subject: Reply with quote

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: http://www.youtube.com/watch?v=Yu_moia-oVI.
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: http://www.youtube.com/watch?v=REElUors1pQ.
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 (http://www.youtube.com/watch?v=REElUors1pQ).
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.
Back to top
Robert G.
Guest





PostPosted: Sun Jun 28, 2009 5:53 pm    Post subject: Reply with quote

And it avoids ads in Spotify! You have to use these parameters: Spotify, – (em-dash, ALT+0150), 1, Yes.
Back to top
mrgnome
Guest





PostPosted: Fri Jul 17, 2009 3:26 am    Post subject: Reply with quote

The mute should mute the soundcard not Spotify. Spotify doesnt recognize a soundcard mute, and does not pause the ads then.
Back to top
Robert G.
Guest





PostPosted: Fri Jul 17, 2009 10:27 am    Post subject: Reply with quote

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
Back to top
Kote
Guest





PostPosted: Mon Aug 24, 2009 2:26 pm    Post subject: Reply with quote

New release (MUkoTE 1.1) with a lot of new features.
http://cosechapropia.blogspot.com/2009/08/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...
Back to top
bazoomajoe
Guest





PostPosted: Sun Sep 06, 2009 6:59 pm    Post subject: Reply with quote

finally got the hang of this program - you have answered my prayers! many thanks
Back to top
daorc



Joined: 18 Oct 2006
Posts: 169

PostPosted: Mon Sep 28, 2009 4:21 pm    Post subject: Reply with quote

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?!
Back to top
View user's profile Send private message
mrgnome
Guest





PostPosted: Sun Oct 04, 2009 4:27 am    Post subject: Reply with quote

Robert G. wrote:
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.
Back to top
mrgnome
Guest





PostPosted: Sun Oct 04, 2009 4:40 am    Post subject: Reply with quote

mrgnome wrote:
Robert G. wrote:
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?
Back to top
intestinate
Guest





PostPosted: Sat Nov 07, 2009 1:40 am    Post subject: Reply with quote

daorc - you are a prick
Back to top
daorc_
Guest





PostPosted: Sat Nov 07, 2009 1:42 am    Post subject: Reply with quote

yes i know
Back to top
willb
Guest





PostPosted: Thu Nov 19, 2009 12:11 am    Post subject: Reply with quote

kote,
you are a legend, works perfectly!

and 2 all u muppets moaning, spotify still get their £££ when u mute the ads. friggin losers.
Back to top
intestinate
Guest





PostPosted: Fri Dec 04, 2009 12:07 am    Post subject: Reply with quote

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 ...
Back to top
aj
Guest





PostPosted: Fri Dec 04, 2009 11:48 pm    Post subject: Reply with quote

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?
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group