Version: 1.0

Posted: 2006-07-27

Build Requirements: Xcode 2.3

Runtime Requirements: This app uses Apple events to communicate over TCP/IP so you must have "Remote Apple Events" turned on in the "Sharing" pane of the "System Preferences" before you can run the application.

View Source Code:

Download Sample (“AttachAScript.zip”, 264.6K)
Download Sample (“AttachAScript.dmg”, 324.3K)



Description

If your application needs to communicate with other applications or processes, it can use AppleScript as a communication layer. Using the techniques described here, the included scripts handle all of the communication details while your application just makes calls to the scripting machinery. This design allows you to modularize the part of your application concerned with interprocess communication. The scripts are stored in the application's Resources folder and can be tuned in the field for particular needs and requirements, potentially by end users, without needing to recompile the application.

This sample targets the iTunes application, using remote Apple events over a network. The scripts handle all of the details involved in communicating with iTunes, while the program provides the user interface.

Document Revision History

Date Notes
2006-07-27Illustrates how you can extend any Cocoa application by adding some AppleScripts to it.

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.