arrow-left arrow-right brightness-2 chevron-left chevron-right facebook-box facebook loader magnify menu-down rss-box star twitter-box twitter white-balance-sunny window-close
Use AppleScript (and LaunchBar) to mute system volume for a specified duration, and then unmute it
1 min read

Use AppleScript (and LaunchBar) to mute system volume for a specified duration, and then unmute it

I find commercials excruciating, and my exasperation grows commensurate with the number of times I have to hear the same one, to the point where I sometimes consider ending it all.

Relatedly, I tend to have news on in the background when working from home (via TuneIn), and because I’m now working from home full time and will be for the foreseeable future (thanks Trump!), I’m forced to listen to the same commercials 100 times a day!

I know what you’re thinking: just mute the commercials! Sure, but because it's audio-only there’s no cue that the commercial break is over, and so I rarely remember to unmute in a timely manner and subsequently miss a lot of actual content. To remedy this, I created a dead simple AppleScript that mutes the system  volume, waits a prescribed amount of time, and then unmutes it.

set volume with output muted 
delay 240 --length of delay in seconds 
set volume without output muted

You of course can launch this a million different ways (and you should use whatever is most efficient for you), but I use LaunchBar, because, well, I use LaunchBar for damn near everything.

If you too want to go this route, simply put your script in ~/Library/Application Support/LaunchBar/Actions and invoke it as you would any other command in LaunchBar. Note that you’ll want the script to run in the background, so use Option+Return when executing it.

You've successfully subscribed to Justin Blanton.
Success! Your account is fully activated, you now have access to all content.