- Viewing Photoshop CS2 objects, commands, and methods
- Creating new objects in a script
- Setting the active object
- Opening a document
- Saving a document
- Setting application preferences
- Suppressing dialog boxes
- Working with the Adobe Photoshop CS2 Object Model
- Working with color objects
- Working with filters
- Understanding clipboard interaction
- Working with units
- Advanced scripting
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.