Advertisement

Mac 101: schedule your scripts

We talk about iCal once in a while. Did you know that an iCal alarm can launch an AppleScript? A recent comment from reader Zach (and subsequent replies) made us think that this tip might be of use to anyone who hasn't considered the possibilities.

When you schedule an alarm in iCal, one of the options for the alarm is "Run script." If you select "Other..." from the script selection dropdown, you can choose any AppleScript you want to launch. Then you just tell the alarm when to go off and your script will run.

Considering that AppleScript can control quite a few of the applications on your mac, and that iCal can handle repeating events, the possibilities are wide open. You could do something as simple as schedule applications by putting the following into a script in Script Editor and saving it as a regular script:

tell application "Safari" to activate

and another one...

tell application "Safari" to quit

to quit. Of course, you could then add to the scripts to have Safari navigate to certain pages as well. And you could launch as many apps as you want in the same script. Anything you can do with AppleScript, you can schedule. For more Terminal-savvy readers, Applescript's "do shell script" command allows for an even wider range of possibilities. You can even get user interaction with a "display dialog" command. I'm sure there's someone here who could have a blast with this.