Sunday, November 1, 2009

Mute Spotify ads

Are you annoyed by Spotify pausing ads when you press mute? Here is a by-pass. It lets you mute your computer using the key combination of your choice (except Mute, unfortunately). Spotify won't notice and will let you skip the ad.

It is based on this observation, and on pieces of scripts from here and here.

The following AppleScript operates Spotify's pause/play command, then mute/unmute, and then pause/play again. Oddly enough, it does the trick, as long as they don't fix it.

--

on spotifypp()
 tell application "System Events"
  set MyList to (name of every process)
 end tell
 
 tell application "System Events" to set appList to ¬
  name of application processes whose frontmost is true
 set activeApp to item 1 of appList
 if (MyList contains "Spotify") is true then
  tell application "Spotify" to activate
  tell application "System Events"
  tell process "Spotify"
  click menu item 1 of menu 1 of menu bar item 5 of menu bar 1
  end tell
  end tell
 end if
end spotifypp

spotifypp()
set isMuted to output muted of (get volume settings)
set newMuted to not isMuted
set volume output muted newMuted
spotifypp()

--

Copy-paste in AppleScript editor. Hit the Compile button to check. Save it as a script under ~/Library/Scripts/.

To trigger the script with a keystroke, I use Quicksilver. Once Quicksilver is installed on your computer, open QuickSiver Preference, click Triggers, then + in the bottom. In the first box, pick your script. In the second box, pick Run.

To choose the key combination, click on the right side of your trigger bar. It will open a new pane for this.

This is it. Make sure Quicksilver is running when you listen to Spotify. I also recommend to use Growl. Growl displays a notification when a new song is playing. This tells you when to unmute.

1 comment:

  1. well done but you could just press the mute button on your keyboard, and then press it again when the ad finnishes.

    ReplyDelete