Scripting Support

Allow users to control your app with AppleScript and other automation technologies, or run scripts from within your app.

Topics

Script Execution

NSAppleScript

An object that provides the ability to load, compile, and execute scripts.

Apple Event Handling

NSAppleEventDescriptor

A wrapper for the Apple event descriptor data type.

NSAppleEventManager

A mechanism for registering handler routines for specific types of Apple events and dispatching events to those handlers.

Script Commands

NSScriptCommand

A self-contained scripting statement.

NSQuitCommand

A command that quits the specified app.

NSSetCommand

A command that sets one or more attributes or relationships to one or more values.

NSMoveCommand

A command that moves one or more scriptable objects.

NSCreateCommand

A command that creates a scriptable object.

NSDeleteCommand

A command that deletes a scriptable object.

NSExistsCommand

A command that determines whether a scriptable object exists.

NSGetCommand

A command that retrieves a value or object from a scriptable object.

NSCloneCommand

A command that clones one or more scriptable objects.

NSCountCommand

A command that counts the number of objects of a specified class in the specified object container.

NSCloseCommand

A command that closes one or more scriptable objects.

Object Specifiers

NSScriptObjectSpecifier

An abstract class used to represent natural language expressions.

NSPropertySpecifier

A specifier for a simple attribute value, a one-to-one relationship, or all elements of a to-many relationship.

NSPositionalSpecifier

A specifier for an insertion point in a container relative to another object in the container.

NSRandomSpecifier

A specifier for an arbitrary object in a collection or, if not a one-to-many relationship, the sole object.

NSRangeSpecifier

A specifier for a range of objects in a container.

NSUniqueIDSpecifier

A specifier for an object in a collection (or container) by unique ID.

NSWhoseSpecifier

A specifier that indicates every object in a collection matching a condition.

NSNameSpecifier

A specifier for an object in a collection (or container) by name.

NSMiddleSpecifier

A specifier indicating the middle object in a collection or, if not a one-to-many relationship, the sole object.

NSIndexSpecifier

A specifier representing an object in a collection (or container) with an index number.

NSRelativeSpecifier

A specifier that indicates an object in a collection by its position relative to another object.

Script Dictionary Description

NSScriptSuiteRegistry

The top-level repository of scriptability information for an app at runtime.

NSScriptClassDescription

A scriptable class that a macOS app supports.

NSClassDescription

An abstract class that provides the interface for querying the relationships and properties of a class.

NSScriptCommandDescription

A script command that a macOS app supports.

Object Matching Tests

NSScriptWhoseTest

An abstract class that provides the basis for testing specifiers one at a time or in groups.

NSSpecifierTest

A comparison between an object specifier and a test object.

NSLogicalTest

The logical combination of one or more specifier tests.

NSObject Script Support

NSComparisonMethods

A collection of default comparison methods useful for performing specifier tests.

NSScriptingComparisonMethods

A collection of methods useful for comparing script objects.

NSScriptKeyValueCoding

A collection of methods that provide additional capabilities for working with key-value coding.

NSScriptObjectSpecifiers

A collection of methods providing additional object specifier functionality.

NSScriptCoercionHandler

A mechanism for converting one kind of scripting data to another.

NSScriptExecutionContext

The context in which the current script command is executed.

See Also

App Support

Task Management

Manage your app's work and its interaction with the user and the system.

Resources

Access assets and other data bundled with your app.

Notifications

Design patterns for broadcasting information and for subscribing to broadcasts.

App Extension Support

Manage the interaction between an app extension and its hosting app.

Errors and Exceptions

Respond to problem situations in your interactions with APIs, and fine-tune your app for better debugging.