O'Reilly logo

Mac OS X Hacks by Rael Dornfest, Kevin Hemenway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Running AppleScripts on a Regular Basis Automatically

Automating tasks with AppleScript has always been a powerful feature of the Macintosh operating system; but, until recently, automating tasks repetitively required new software. With OS X, repetitious automation is built in.

AppleScript (http://www.apple.com/applescript/) is a wonderful piece of technology that has long been part of the Macintosh OS. Just about any application can become AppleScript-powered, allowing automated tasks to be written in a simple, English-like language. Because of this power and the ease with which it can be had, kazillions of ApplesScripts have been written, ranging from automating backups of emails, archiving data from network-enabled services, and Finder-based scripts that promote organization (make all these files lowercase), to plug-ins (type itunes to place the currently playing song on the clipboard).

What has been missing, however, is automation of the automation, repetitively running an AppleScript without user intervention. Take the following simple script, for example:

say the (current date) as string

Exemplar of AppleScript bluntness, this uses text to speech to enunciate the current day and time. Type it into Script Editor (in Applications AppleScript), click Run, and listen closely.

That’s all well and good, but what if you wanted the time spoken each and every hour, on the hour? Under Mac OS 9 and earlier, you would have had to make use of a third-party scheduling application — ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required