AppleScript, the user-level scripting system that has been built into Macs since long before Mac OS X, enables users to automate repetitive actions, extend applications' abilities, and even create full-fledged, stand-alone applications using a relatively simple English-like language. Behind the scenes, AppleScript communicates with Mac OS X and individual applications using a lower-level messaging system called Apple Events.
In most cases, AppleScripts are designed to perform activities on the Mac on which they're running, just like any other application. However, AppleScript has the capability to tell other Macs to perform the same sorts of actions, with only slightly more code than is required to send the messages to one's own Mac. For example, AppleScript could instruct another Mac on your network to shut down, display an alert, or play a song in iTunes.
In order for AppleScript to work on a remote Mac, the computer running the script must be able to reach the remote Mac via TCP/IP, it must supply a valid username and password, and the Mac to which it's connecting must have Remote Apple Events enabled.
As with all sharing features discussed in this chapter, you should turn on Remote Apple Events only if you're certain you need it. A hacker who knew your Mac's IP address and a valid username and password could wreak all sorts of havoc, and it's best to leave all unnecessary avenues of attack closed off.
To enable Remote Apple Events, follow these steps: ...