Class

NSScript​Suite​Registry

NSScript​Suite​Registry functions as the top-level repository of scriptability information for an application at runtime.

Overview

Scriptability information specifies the terminology available for use in scripts that target an application. It also provides information, used by AppleScript and by Cocoa, about how support for that terminology is implemented in the application. This information includes descriptions of the scriptable object classes in an application and of the commands the application supports.

There are two standard formats for supplying scriptability information: the older script suite format, consisting of a script suite file and one or more script terminology files, and the newer scripting definition (or sdef) format, consisting of a single sdef file.

There is one instance of NSScript​Suite​Registry per scriptable application. This registry object collects scriptability information when the application first needs to respond to an Apple event for which Cocoa hasn't installed a default event handler. It then creates one instance of NSScript​Class​Description for each object class and one instance of NSScript​Command​Description for each command class, and installs a command handler for each command.

When a user executes an AppleScript script, Apple events are sent to the targeted application. Using the information stored in the registry object, Cocoa automatically converts incoming Apple events into script commands (based on NSScript​Command or a subclass) that manipulate objects in the application.

The public methods of NSScript​Suite​Registry are used primarily by Cocoa’s built-in scripting support. You should not need to create a subclass of NSScript​Suite​Registry.

For information on scriptability information formats, loading of scriptability information, and related topics, see "Scriptability Information" in Overview of Cocoa Support for Scriptable Applications in Cocoa Scripting Guide.

Symbols

Getting and Setting the Shared Instance

class func set​Shared(NSScript​Suite​Registry)

Sets the single, shared instance of NSScript​Suite​Registry to registry.

class func shared()

Returns the single, shared instance of NSScript​Suite​Registry, creating it first if it doesn’t exist.

Getting Suite Information

func suite(for​Apple​Event​Code:​ Four​Char​Code)

Returns the name of the suite definition associated with the given four-character Apple event code, code.

var suite​Names:​ [String]

Returns the names of the suite definitions currently loaded by the application.

Getting and Registering Class Descriptions

func class​Descriptions(in​Suite:​ String)

Returns the class descriptions contained in the suite identified by suite​Name.

func class​Description(with​Apple​Event​Code:​ Four​Char​Code)

Returns the class description associated with the given four-character Apple event code, code.

func register(NSScript​Class​Description)

Registers class description class​Description for use by Cocoa’s built-in scripting support by storing it in a per-suite internal dictionary under the class name.

Getting and Registering Command Descriptions

func command​Descriptions(in​Suite:​ String)

Returns the command descriptions contained in the suite identified by suite​Name.

func command​Description(with​Apple​Event​Class:​ Four​Char​Code, and​Apple​Event​Code:​ Four​Char​Code)

Returns the command description identified by a suite’s four-character Apple event code of the class (event​Class) and the four-character Apple event code of the command (command​Code).

func register(NSScript​Command​Description)

Registers command description command​Desc for use by Cocoa’s built-in scripting support by storing it in a per-suite internal dictionary under the command name.

Getting Other Suite Information

func aete​Resource(String)

Returns an NSData object that contains data in 'aete' resource format describing the scriptability information currently known to the application.

func apple​Event​Code(for​Suite:​ String)

Returns the Apple event code associated with the suite named suite​Name, such as ‘core’ for the Core suite.

func bundle(for​Suite:​ String)

Returns the bundle containing the suite-definition property list (extension .script​Suite) identified by suite​Name.

Loading Suites

func load​Suite(with:​ [Any​Hashable :​ Any], from:​ Bundle)

Loads the suite definition encapsulated in dictionary; previously, this suite definition was parsed from a .script​Suite property list contained in a framework or in bundle.

func load​Suites(from:​ Bundle)

Loads the suite definitions in bundle a​Bundle, invoking load​Suite(with:​from:​) for each suite found.

Relationships

Inherits From