Murphy Mac - Screencasts and Tutorials » Page 'iTunes Alarm Clock'

iTunes Alarm Clock

Share

iTunes Alarm ClockYou Mac has some pretty fancy features built into its hardware, including the ability to turn itself on when it’s sleeping or powered off. This capability leverages nicely into an iTunes alarm clock.

In the screencast we’ll use the System Preferences to turn the Mac on at a specified time. Then we’ll set an appointment in iCal that runs an AppleScript a few minutes later. The script will kick off a Playlist in iTunes loaded with songs we’d like to wake up to.

Murphy made a few different scripts for the job. You can pick one or combine pieces from all of them to make your own. Here’s what they do:

  • Wakeup1.scpt Script simply plays a Playlist
  • Wakeup2.scpt Script plays each track in a Playlist for a specified number of seconds. That should annoy you out of bed.
  • Volume.scpt Script gradually increases the iTunes volume until you click stop in iTunes.

You can download the scripts and edit them for your own needs. Feel free to post improvements in the comments.

We’re halfway through iTunes week. We’ll look at more AppleScripts the rest of the week courtesy of Doug’s AppleScripts for iTunes. Don’t forget to check back! Or better yet, subscribe to Murphy’s feed.

Watch Now | Permalink

8 comments to “iTunes Alarm Clock”

  1. Great little trick, but Aurora does all that and it is free. So in case people do not wish to tinker with applescripts, there is an alternative.
    Also, is there a script that can serve like a “snooze” function?

  2. You could definitely do a snooze. Have the script throw up a dialog that you click for snooze and that kicks off a delay. I’ll tinker with it if I get a second.

    There are probably 3rd party things for a lot of the stuff I post, and I appreciate you pointing it out – I don’t always go looking.

    I also think simple things like this are a good place for people to get their feet wet with AppleScript. I’m not a coder by ANY stretch, and it took me 90 minutes to scribble out the volume script last night, after starting over a couple times. But in the end I had a better idea of how AppleScript handles Repeats.

    Thanks.

  3. Well, Murphy, I am new to Mac and I must say that I am learning AppleScript by using your examples. Maybe you know a little more that you put on 😉

    Love the site. Keep up the great work.

  4. What an interesting mix of apps… never would have thought to use iCal this way.. very cool tip. (I’m new to macs)

  5. I followed the instructions and it doesnt work. i ran the script and it does work, I also checked the settings, any idea what I could be doing wrong?

    Thanks for your help

    Cisco

  6. NM Got it working

    THANK YOU SO MUCH

  7. set fadeStart to 0
    set fadeStop to 100
    set fadeStep to 2
    set snoozeMinutes to 6

    set userVolume to output volume of (get volume settings)
    set volume output volume 100

    tell the application “iTunes”
    set the sound volume to fadeStart
    play playlist “awaken”

    set fadeIn to fadeStart
    repeat until fadeIn = fadeStop
    if the player state is stopped then exit repeat
    delay 1
    set the sound volume to fadeIn
    set fadeIn to fadeIn + fadeStep

    if the player state is paused then
    set fadeIn to fadeStart
    delay (60 * snoozeMinutes)
    tell the application “iTunes”
    set the sound volume to fadeIn
    play
    end tell
    end if
    end repeat
    end tell

    tell the application “iTunes”
    repeat until the player state is stopped
    — do nothing
    end repeat
    end tell

    set volume output volume userVolume

  8. Fabulous, what a web site it is! This web site presents helpful facts
    to us, keep it up.

Leave a comment