Next Page > Hide TOC

NSSetCommand Class Reference

Inherits from
Conforms to
Framework
/System/Library/Frameworks/Foundation.framework
Availability
Available in Mac OS X v10.0 and later.
Companion guide
Declared in
NSScriptStandardSuiteCommands.h

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 replaceValueAtIndex:inPropertyWithKey:withValue:; for the former, it invokes setValue:forKey: (or, if the receiver overrides 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 in Cocoa Scripting Guide.

Tasks

Working with Specifiers

Instance Methods

keySpecifier

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

- (NSScriptObjectSpecifier *)keySpecifier

Return Value

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

Availability
Declared In
NSScriptStandardSuiteCommands.h

setReceiversSpecifier:

Sets the receiver’s object specifier.

- (void)setReceiversSpecifier:(NSScriptObjectSpecifier *)receiversRef

Parameters
receiversRef

The receiver’s object specifier.

Discussion

When the command is executed, it sets attributes or relationships in the objects specified by receiversRef.

This method overrides setReceiversSpecifier: in NSScriptCommand. It performs the same function as the overridden method, with a critical difference: it causes the container specifier part of the passed-in object specifier to become the receiver specifier of the command, and the key part of the passed-in object specifier to become the key specifier. If, for example, receiversRef is a specifier for the color of the third rectangle, the receiver specifier is the third rectangle, while the key specifier is the color.

Availability
Declared In
NSScriptStandardSuiteCommands.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.