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

# NSSetCommand

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

```
class NSSetCommand
```

## Overview

An instance of `NSSetCommand` sets one or more attributes or relationships to one or more values; for example, it may set the (x, y) coordinates for a window’s position or set the name of a document.

`NSSetCommand` is part of Cocoa’s built-in scripting support. It works automatically to support the `set` command through key-value coding. Most applications don’t need to subclass `NSSetCommand` or call its methods.

`NSSetCommand` uses available scripting class descriptions to determine whether it should set a value for an attribute (or property), or set a value for all elements (to-many objects). For the latter, it invokes <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/replaceValue(at:inPropertyWithKey:withValue:)>; for the former, it invokes <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/setValue(_:forKey:)> (or, if the receiver overrides <doc://com.apple.documentation/documentation/ObjectiveC/NSObject-swift.class/takeValue(_:forKey:)>, it invokes that method, to support backward binary compatibility.)

For information on working with `set` commands, see [Getting and Setting Properties and Elements](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_get_set/SAppsGetSet.html#//apple_ref/doc/uid/TP40002164-CH18) in [Cocoa Scripting Guide](https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ScriptableCocoaApplications/SApps_intro/SAppsIntro.html#//apple_ref/doc/uid/TP40002164).

## Topics

### Working with specifiers

[`keySpecifier`](/documentation/Foundation/NSSetCommand/keySpecifier)

Returns a specifier that identifies the attribute or relationship that is to be set for the receiver of the `set` AppleScript command.

[`-  setReceiversSpecifier:`](/documentation/Foundation/NSSetCommand/setReceiversSpecifier(_:))

Sets the receiver’s object specifier.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

### Inherits From

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

---

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)