Linking Programs across the Network

You have seen how AppleScript can automate tasks on your own computer. AppleScript can send Apple events messages to open applications on other Macs in a network. As a result, you can use AppleScript to control applications on other people's computers. Of course, the reverse is also true: Other people can use AppleScript to control applications on your computer.

Sharing programs by sending and receiving Apple events messages across a network is called program linking. For security reasons, program linking is normally disabled. Computers that you want to control with AppleScript must be set to allow remote Apple events. Likewise, you must set your computer to allow remote Apple events.

OS X uses the TCP/IP (Transmission Control Protocol/Internet Protocol) standard to send and receive Apple events messages over a network. Therefore, OS X can send and receive Apple events messages over the Internet as well as over a local network.

Allowing remote Apple events

If you want an OS X computer to receive Apple events from remote computers, you must set it to allow remote Apple events. First, open the Sharing system preference and go to the Remote Apple Events pane. Select the check box to the left of the Remote Apple Events label in the Sidebar to turn on Apple events. You can restrict the execution of Apple events to specific users by selecting Only These Users and clicking the + icon button to add the permitted users.

Caution

The All Users option ...

Get OS X Mountain Lion Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.