Creating new objects in a script
To create a new document in the Adobe Photoshop CS2 application, you select File > New. To create other types of objects within a document, such as a layer, channel, or path, you use the Window menu or choose the New icon on the appropriate palette. This section demonstrates how to accomplish these same tasks in a script.
To create an object in a script, you name the type of object you want to create and then use the add() method.
As you can see in the Adobe Photoshop CS2 Object Model, the Document object contains all other objects except the Application object. Therefore, you must reference the Document object when adding objects other than Document objects to your script.
To add an ArtLayer object, you must reference the Document object that will contain the layer.
Similarly, the ArtLayer object does not have an add() method; the ArtLayers object does.