NSMoveCommand Class Reference

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

Overview

An instance of NSMoveCommand moves the specified scriptable object or objects; for example, it may move words to a new location in a document or a file to a new directory.

NSMoveCommand is part of Cocoa’s built-in scripting support. It works automatically to support the move AppleScript command through key-value coding. Most applications don’t need to subclass NSMoveCommand or invoke its methods. However, for circumstances where you might choose to subclass this command, see "Modifying a Standard Command" in Script Commands in Cocoa Scripting Guide.

When an instance of NSMoveCommand is executed, it does not make copies of moved objects. It removes objects from the source container or containers, then inserts them into the destination container.

Tasks

Working with Specifiers

Instance Methods

keySpecifier

Returns a specifier for the object or objects to be moved.

- (NSScriptObjectSpecifier *)keySpecifier
Return Value

A specifier for the object or objects to be moved.

Discussion

Note that this specifier may be different than the specifier set by setReceiversSpecifier:, which sets the container specifier. For example, for a command such as move the third circle to the location of the first circle, the receiver might identify a document (which has a list of graphics), while the key specifier identifies the particular graphic to be moved.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptStandardSuiteCommands.h

setReceiversSpecifier:

Sets the receiver’s object specifier.

- (void)setReceiversSpecifier:(NSScriptObjectSpecifier *)receiversRef
Parameters
receiversRef

The receiver’s object specifier.

Discussion

When evaluated, receiversRef indicates the receiver or receivers of the move AppleScript command.

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 third paragraph of the first document, the receiver specifier is the first document while the key specifier is the third paragraph.

Availability
  • Available in OS X v10.0 and later.
Declared In
NSScriptStandardSuiteCommands.h