Introduction to Cocoa Scripting Guide

This document describes how to create scriptable applications using the support provided by the Cocoa application framework. That support, which is referred to as Cocoa scripting, includes classes, categories, and scriptability information.

A scriptable application is one that can be controlled by AppleScript scripts. Users write scripts to automate tasks and combine the use of multiple applications. As a developer, you can also use scripts to speed up prototyping or testing of your scriptable applications.

When a script that targets an application is executed, commands are sent to the application in the form of Apple events, a kind of interprocess message. Cocoa scripting helps you create scriptable applications by doing much of the work of receiving these Apple events, extracting information from them, and invoking methods in your scriptable classes.

This document provides conceptual information and examples that are based primarily on the scripting support available in OS X versions 10.4 and 10.3.

Although some information may be accurate for versions of the Mac OS prior to v10.3, this document has not been reviewed for accuracy on those versions, nor does it attempt to provide details for working with those versions.

Who Should Read This Document

This document is intended for developers who want to make their Cocoa applications scriptable or who need to know more about how Cocoa applications interact with AppleScript and Apple events. It assumes you have some familiarity with Cocoa, Objective-C, and AppleScript. However, if you are unfamiliar with AppleScript, you should start by reading Getting Started with AppleScript and AppleScript Overview. Many of the terms scripters use are defined in AppleScript Language Guide.

Organization of This Document

The following chapters describe how to design, implement, and debug a scriptable Cocoa application:

The following chapters provide additional information about Cocoa scripting support:

The following chapter describes how to specify scriptability information using an earlier format:

See Also

For more information on the basic design patterns used by Cocoa scripting support, see Key-Value Coding Programming Guide.