A command that creates a scriptable object.
SDK
- macOS 10.0+
Framework
- Foundation
Declaration
class NSCreateCommand : NSScript Command
Overview
An instance of NSCreate
creates the specified scriptable object (such as a document), optionally supplying the new object with the specified attributes. This command corresponds to AppleScript’s make
command.
NSCreate
is part of Cocoa’s built-in scripting support. Most applications don’t need to subclass NSCreate
or invoke its methods.
When an instance of NSCreate
is executed, it creates a new object using [[the
(where the
is the class of the object to be created), unless the command has a with data
argument. In the latter case, the new object is created by invoking [[NSScript
. Any properties specified by a with properties
argument are then set in the new object using -set
.
If an NSCreate
object with no argument corresponding to the at
parameter is executed (for example, tell application "Mail" to make new mailbox with properties {name:"test
), and the receiver of the command (not necessarily the application object) has a to-many relationship to objects of the class to be instantiated, and the class description for the receiving class returns false
when sent an is
message, the NSCreate
object creates a new object and sends the receiver an insert
message to place the new object in the container. This is part of Cocoa’s scripting support for inserting newly-created objects into containers without explicitly specifying a location.