AutoHotkey Community

It is currently May 26th, 2012, 11:32 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: June 28th, 2009, 5:44 pm 
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
  }
 }
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2009, 5:50 pm 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2009, 6:53 pm 
And it avoids ads in Spotify! You have to use these parameters: Spotify, – (em-dash, ALT+0150), 1, Yes.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 4:26 am 
The mute should mute the soundcard not Spotify. Spotify doesnt recognize a soundcard mute, and does not pause the ads then.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 17th, 2009, 11:27 am 
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:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 24th, 2009, 3:26 pm 
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...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 6th, 2009, 7:59 pm 
finally got the hang of this program - you have answered my prayers! many thanks


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2009, 5:21 pm 
Offline

Joined: October 18th, 2006, 8:07 pm
Posts: 169
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?!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 5:27 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 5:40 am 
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?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 2:40 am 
daorc - you are a prick


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 7th, 2009, 2:42 am 
yes i know


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 1:11 am 
kote,
you are a legend, works perfectly!

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2009, 1:07 am 
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 ...


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2009, 12:48 am 
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?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group