Understanding clipboard interaction
The clipboard methods in Adobe Photoshop CS2 operate on ArtLayer and Selection objects. The methods can be used to operate on objects within a single document, or to move information between documents.
The clipboard methods of the ArtLayer and Selection objects are:
- copy(merge parameter value)
- paste(intoSelection parameter value)
Using the Copy and Paste methods
The following example copies the contents an the background layer to the clipboard, creates a new document, and then pastes the clipboard contents to the new document. The scripts assume that there is a document already open in Adobe Photoshop CS2 and that the document has a background layer.
//make firstDocument the active document var docRef = app.activeDocument docRef.artLayers["Background"].copy() var newDocRef = app.documents.add(8, 6, 72, "New Doc") newDocRef.paste()
Using the Copy Merged method
Look up the copy() method in the Methods table for the ArtLayer and Selection objects in Part 2 of this book.