Contents

NSScriptCommand

A self-contained scripting statement.

Declaration

class NSScriptCommand

Overview

An instance of NSScriptCommand represents a scripting statement, such as set word 5 of the front document to word 1 of the second document, and contains the information needed to perform the operation specified by the statement.

When an Apple event reaches a Cocoa application, Cocoa’s built-in scripting support transforms it into a script command (that is, an instance of NSScriptCommand or one of the subclasses provided by Cocoa scripting or by your application) and executes the command in the context of the application. Executing a command means either invoking the selector associated with the command on the object or objects designated to receive the command, or having the command perform its default implementation method (performDefaultImplementation()).

Your application most likely calls methods of NSScriptCommand to extract the command arguments. You do this either in the performDefaultImplementation method of a command subclass you have created, or in an object method designated as the selector to handle a particular command.

As part of Cocoa’s standard scripting implementation, NSScriptCommand and its subclasses can handle the default command set for AppleScript’s Standard suite for most applications without any subclassing. The Standard suite includes commands such as copy, count, create, delete, exists, and move, as well as common object classes such as application, document, and window.

For more information on working with script commands, see Script Commands in Cocoa Scripting Guide.

Topics

Initializing a script command

Getting the current command

Getting the Apple event

Executing the command

Accessing receivers

Accessing arguments

Accessing the direct parameter

Getting command information

Handling script execution errors

Suspending and resuming commands

Constants

Initializers

See Also

Script Commands