This chapter provides an overview of Cocoa scripting and how your application takes advantage of it, and provides links to more detailed information in other chapters and documents.
A scriptable application is one that scripters can control with AppleScript scripts. To create a scriptable application, you specify a dictionary of terms that scripters can use with your application, implement classes and methods to support scriptable features, and provide a road map of scriptability information that AppleScript and Cocoa use to allow scripts to control the application.
Cocoa scripting refers to the support provided by the Cocoa application framework for creating scriptable applications. It includes classes, categories, and scriptability information that specifies the supported AppleScript terminology and the class information needed to work with it.
Cocoa scripting makes use of standard mechanisms and design patterns used throughout Cocoa, including key-value coding (KVC) and Model-View-Controller (MVC). When an AppleScript command targets your application, the goal of the scripting support is to send the command directly to the application's model objects to perform the work. To do that, it relies on the KVC mechanism to get and set values in your application's scriptable model objects, based on a set of keys you define for them.
Through the use of these mechanisms, you can make your application scriptable with a minimum of additional code.
AppleScript and Scriptable Applications
The AppleScript Object Model
Scriptability Information
Reliance on Key-Value Coding
Interaction With Cocoa Bindings and Core Data
Scriptability and Undo
Snapshot of Cocoa Scripting
A Real World Scripting Example
Current Limitations of Cocoa Scripting Support
Last updated: 2008-03-11