Turn your mac into a Pandora alarm clock
Here’s a tutorial for anyone wanting to turn their fancy new $2000 Mac into a $19.99 clock radio.
We’re going to use AppleScript, iCal, and the awesome PandoraBoy to get everything working. I thought this would be clunky at first but it’s actually really nice and flexible if you break things up the way I’m about to show you.
Open up your AppleScript Editor and create the following three files:
Mute.scpt
set volume with output muted
This does exactly what you think it does, mutes the mac.
Unmute.scpt
set volume without output muted
set volume 1.3
You can change the 1.3 to anything between 0 and 7. Play some music and click the run button in AppleScript Editor to fine tune this.
PlayPandora.scpt
tell application "PandoraBoy"
activate
repeat 10 times
try
set current station to station 1
exit repeat
on error
delay 10
end try
end repeat
if player state is not "playing" then
playpause
end if
end tell
This one is a bit more complicated. First we tell PandoraBoy.app to start if it’s not already running. The problem is that it take a while to initialize, and it’s unresponsive to scripts during that time. Basically we attempt to change the station, and if it fails we wait 10 seconds and try again, x10. You can change the station number to whatever station you want (1, 2, 3, etc).
iCal
After you’ve created, tested, and saved these scripts somewhere, open up iCal to make the magic happen.

How to attach your script to an event in iCal

It’s really pretty easy once you have the scripts written. Just create an event anywhere, and double click it to change its properties. Click on alarm and pick Run Script. Choose Other… and go find where you saved the script. Then change it to 0 minutes before. That’s it, when that time comes around, the script you chose will run.
The nice thing about this now is that you can just drag that event around anywhere you want. You can duplicate it. You can make it repeat every day or just on weekdays. The script will still run.
As a baseline, start with two events every day, Mute.scpt when you go to sleep, and Unmute.scpt right before you wake up.
Create a third event to run PlayPandora.scpt only on weekdays, or only days you have work or school. It’s flexible!
It’s great to not get woken up by an alarm on your day off, or to be able to quickly delete the alarm on upcoming holidays.
Not to mention waking up to awesome music!
Notes
- This will not work if you put your mac to sleep at night. I know, it’s annoying. You can force your computer to wake on a schedule by going to System Preferences > Energy Saver > Schedule… I just turn off the display with
control+shift+eject. - Pandora will stop playing music after 1 hour and ask you if you’re still listening.
- If your internet connection happens to be down, you won’t get any music.
- You will forget to unplug your headphones one day and miss your appointment. I take absolutely no responsibility for this!
- You will still have to make your own coffee.
Have fun!