Want a free year on Tuts+ (worth $180)? Start an InMotion Hosting plan for $3.49/mo.
It's easy to get just about anything done on your Mac with Automator. Need to make sure you get up in the morning? Your Mac can help! In this tutorial I'll show you how to use Automator to create a simple alarm clock and I'll briefly explore System Preferences to ensure everything goes off without a hitch. It’s a pretty simple task to turn a Mac into an alarm clock, and I won’t even need any third-party applications to get the job done.
1. Tell Your Mac To Start Up On Its Own
A Mac doesn't make a very good alarm clock if it’s turned off when we're asleep. Of course, if you leave your Mac on all the time, or at least overnight, you can skip this part.
I suggest, however, taking a look at what we do here and think about replicating an automated startup procedure on your Mac, even if you never plan on using it. If you, your partner, or your kids ever do inadvertently shut down or put your Mac to sleep at night or you suffer a temporary power failure, your Mac’s not going to be ready to wake you come morning.
To get started, open Energy Saver Preferences in System Preferences. In either the Battery or Power Adapter panes, it doesn’t matter which, click Schedule...
Looking at the first option, Start up or Wake. choose the days of the week that the Mac is to serve as an alarm clock, and whilst options are limited--It is not possible to select Monday, Tuesday, and Wednesday only, for example--this step is only turning your Mac on. We’ll create the actual alarm in the next step, so don’t worry too much about setting too narrow a range.
Tip: If you have an irregular schedule and don’t want to be woken on your off days, disable the Mac startup sound using a third-party utility, like Cocktail.
Choose a time for the Mac to start itself up, but don't set it for the same time that you need to be woken. The Mac will need enough time to turn itself on and get running. For example, if I need to be up at 6:30 AM, then, I can set my Mac to start up ten minutes before that at 6:20 AM, giving it plenty of time to get going before it has to get me going. Adjust the times to suit your own requirements.
It’s worth noting you can also set your Mac to sleep, restart, and shutdown here, too. Just make sure your shutdown schedule, if you choose to set one, doesn’t interfere with the alarm we’re creating. When you’re all done, hit OK.
Now, head over to Users & Groups in System Preferences. Click Login Options at the bottom of the list of users, and then authenticate by clicking the Lock icon at the bottom of the window and entering the user password. It is possible to set the Automatic Login to the main user ID. This will prevent OS X from asking for a password before logging in, a password that can't be entered when you're still asleep.
2. Create an Automator Workflow
Note: I’m running OS X 10.8 with Calendar, but everything I’m about to lay out can be accomplished in OS X 10.7 with iCal.
Open Automator (located in the Applications folder), then choose Calendar Alarm for my document type. This type of Automator workflow is triggered by an event in Calendar.
It is possible to make the Calendar Alarm do pretty much anything we want, but in this case, I want it to make a noise. In the left pane are all of the actions Automator can perform, but I’m only interested in a couple. The first is Find iTunes Items, and the easiest way to locate the action is to do a search for it. Once I’ve got the action I want, I drag it to the main workflow pane.
It is necessary to edit the action a bit, though. First, the aim is to have Automator find playlists, not tracks, so change that in the dropdown. Now, choose a playlist and enter its name in the field. If it’s a pretty uncommonly named playlist, you won’t have to enter the full name, but if you have a bunch of playlists that all look really similar, get specific. Check that the correct playlist was selected and everything worked out by hitting Run up top and then clicking Results to display the action’s output. If everything went according to plan, a single M3U playlist will be displayed.
That won’t get Automator to play any actual music, though, an essential component to waking my lazy bones up in the morning. One more action is required to do that. A quick search for Play iTunes Playlist should narrow the field. Drag the action into the main workflow pane. There’s nothing to change here, so it's good to go. Hitting Run again should start the music playing.
Save the new workflow (File > Save...) and close Automator. When saved, though, Automator’s going to pop open Calendar and create an event. The time is not appropriate, and it’s not repeating, so the event isn’t a very good alarm as it stands. No problem; that can be fixed.
3. Edit the Calendar Event
Automator already opened up Calendar, but the alarm event can be changed. To do this, locate the new event, which should have been scheduled for the current time and date. Double-clicking will display the details, and clicking Edit allows change to be made.
I’m interested in the time of day, so I’ll fix that first. I want to wake up at 6:30 AM, so change both the start and end times to reflect that.
Once that’s done, I need to set my alarm to repeat. I’m going straight to Custom..., because of the available options, the closest to fitting my needs is “Every day,” and I’m not over the moon about getting woken up at 6:30 in the morning on a Saturday. Here I can set the days of the week I need an alarm, and while I work Monday-Friday, if you have a non-traditional schedule, you can cherry-pick as need be.
After clicking Done, the alarm is repeated across my calendar. Every weekday morning at 6:30, Calendar will run the workflow and play the associated playlist.
Tip: You can give it a test by setting your alarm for just a few minutes in the future and waiting for iTunes to kick into gear.
In this tutorial, I used Automator and Calendar to create a customizable alarm for your Mac. I also delved into System Preferences to make sure your Mac is on when it's time for your alarm to go off. These tools can go far beyond just a simple alarm, as there are tons of actions in Automator. With the help of its myriad actions and the scheduling tools in Calendar, you can set up your Mac to do just about anything you want, including running apps or opening specific files.
Do you use Automator and Calendar to perform routine tasks, like setting your alarm? Let me know how you get it done in the comments!