Mute speaker for 30 seconds during iTunes radio commercial

I’ve recently started listening to iTunes Radio.  It has ::shudder:: commercials.  Ick.  They’re typically 30 seconds, near as I can tell, and you can’t skip them.  I’ve started hitting “mute” as soon as they come on.

But I frequently forget to “unmute”.  Oops.

So I wrote an AutoHotkey script to mute the master speaker for 30 seconds, then automatically unmute it.

; Shift-Control-Alt-F9 -- Because "FN-F9" is the special "mute"
; button on my keyboard, so this is easy to remember
  ; mute the master volume setting
  SoundSet, 1, Master, Mute
  ; display a msg box for 1 second that says you're muting for 30 seconds
  Msgbox,, Commercial, Sound is muted for 30 seconds, 1
  ; sleep for 29 more seconds
  Sleep, 29*1000
  ; unmute the master volume setting
  SoundSet, 0, Master, Mute
  ; and return


Update 2014/02/21: This script has come in handy many times already just today.  Life is good.  🙂