Important: The information in this document is obsolete and should not be used for new development.
Making Your Application Scriptable
To make your application scriptable, you need to
The chapters "Introduction to Apple Events," "Responding to Apple Events," and "Resolving and Creating Object Specifier Records" in this book describe how to perform the first two tasks. The extent to which scripts can control your application depends mainly on the extent of your application's support for Apple events. For example, if your application does not provide the Apple event handlers and object accessor functions required to locate and manipulate windows, users will not be able to use scripts to control your application's windows. Although you should use the definitions in the Apple Event Registry: Standard Suites whenever possible, you have considerable freedom to extend or limit your implementation of the standard Apple events according to the needs of your application.
- define a hierarchy of Apple event objects within your application that you want client applications to be able to identify--that is, which objects can be contained by other Apple event objects in your application, which properties each kind of object can have, and so on
- write Apple event handlers, object accessor functions, and other routines required to implement the Apple events and related object classes that you want to support
- create an
'aete'
resource
The OSA makes it possible to design new kinds of applications that always operate in the background and can be controlled only by means of scripts. For example, it is possible to design a simple telecommunications program that can log on to a network, send and receive text files created by another application, and perform other basic operations in response to scripts without providing any other form of user interface. Such an application would not need to support Apple events that control window movement, the File menu, or the Edit menu; instead, it would need to support only those Apple events that execute its basic telecommunications operations.
At the other extreme, some applications allow users to arrange windows, palettes, and dialog boxes on their screen in many different ways, or to customize menus or other aspects of the presentation of information. If such an application can respond to scripts that control windows, dialog boxes, specialized preferences, and other aspects of the presentation of information, it can allow users who might not otherwise explore those capabilities to take advantage of them. For example, a naive user could execute a script that sets up a powerful word processor with the appropriate menus, window and palette arrangement, and formatting templates for a particular task, such as producing a company newsletter.
Scripting components use
'aeut'
and'aete'
resources to associate Apple event codes supported by your application with corresponding human-language terms used in scripts that control your application. Each scripting component supplies an'aeut'
resource, and each scriptable application provides an'aete'
resource. The next section introduces the'aeut'
and'aete'
resources.
Subtopics
- About Apple Event Terminology Resources