<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSScriptCommandDescription",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSScriptCommandDescription"
  },
  "title" : "NSScriptCommandDescription"
}
-->

# NSScriptCommandDescription

A script command that a macOS app supports.

```
class NSScriptCommandDescription
```

## Overview

A scriptable application provides scriptability information that describes the commands and objects scripters can use in scripts that target the application. An application’s scripting information is collected automatically by an instance of [`NSScriptSuiteRegistry`](/documentation/Foundation/NSScriptSuiteRegistry), which creates an `NSScriptCommandDescription` for each command it finds, caches these objects in memory, and installs a command handler for each command.

A script command instance stores the name, class, argument types, and return type of a command. For example, commands in AppleScript’s Core suite include `clone`, `count`, `create`, `delete`, `exists`, and `move`.

The public methods of `NSScriptCommandDescription` are used primarily by Cocoa’s built-in scripting support in responding to Apple events that target the application. Although you can subclass the `NSScriptCommandDescription` class, it is unlikely that you would need to do so, or to create instances of it.

## Topics

### Initializing a Script Command Description

[`init?(suiteName: String, commandName: String, dictionary: [AnyHashable : Any]?)`](/documentation/Foundation/NSScriptCommandDescription/init(suiteName:commandName:dictionary:))

Initializes and returns a newly allocated instance of `NSScriptCommandDescription`.

### Getting Basic Information About the Command

[`var appleEventClassCode: FourCharCode`](/documentation/Foundation/NSScriptCommandDescription/appleEventClassCode)

Returns the four-character code for the Apple event class of the receiver’s command.

[`var appleEventCode: FourCharCode`](/documentation/Foundation/NSScriptCommandDescription/appleEventCode)

Returns the four-character code for the Apple event ID of the receiver’s command.

[`var commandClassName: String`](/documentation/Foundation/NSScriptCommandDescription/commandClassName)

Returns the name of the class that will be instantiated to handle the command.

[`var commandName: String`](/documentation/Foundation/NSScriptCommandDescription/commandName)

Returns the name of the command.

[`var suiteName: String`](/documentation/Foundation/NSScriptCommandDescription/suiteName)

Returns the name of the suite that contains the command described by the receiver.

### Getting Command Argument Information

[`func appleEventCodeForArgument(withName: String) -> FourCharCode`](/documentation/Foundation/NSScriptCommandDescription/appleEventCodeForArgument(withName:))

Returns the Apple event code for the specified command argument of the receiver.

[`var argumentNames: [String]`](/documentation/Foundation/NSScriptCommandDescription/argumentNames)

Returns the names (or keys) for all arguments of the receiver’s command.

[`func isOptionalArgument(withName: String) -> Bool`](/documentation/Foundation/NSScriptCommandDescription/isOptionalArgument(withName:))

Returns a Boolean value that indicates whether the command argument identified by the specified argument key is an optional argument.

[`func typeForArgument(withName: String) -> String?`](/documentation/Foundation/NSScriptCommandDescription/typeForArgument(withName:))

Returns the type of the command argument identified by the specified key.

### Getting Command Return-Type Information

[`var appleEventCodeForReturnType: FourCharCode`](/documentation/Foundation/NSScriptCommandDescription/appleEventCodeForReturnType)

Returns the Apple event code that identifies the command’s return type.

[`var returnType: String?`](/documentation/Foundation/NSScriptCommandDescription/returnType)

Returns the return type of the command.

### Creating Commands

[`func createCommandInstance() -> NSScriptCommand`](/documentation/Foundation/NSScriptCommandDescription/createCommandInstance())

Creates and returns an instance of the command object described by the receiver.

[`func createCommandInstance(with: NSZone?) -> NSScriptCommand`](/documentation/Foundation/NSScriptCommandDescription/createCommandInstance(with:))

Creates and returns an instance of the command object described by the receiver in the specified memory zone.

### Initializers

[`init?(coder: NSCoder)`](/documentation/Foundation/NSScriptCommandDescription/init(coder:))

## Relationships

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`CVarArg`](/documentation/Swift/CVarArg)

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)