Publishers of technology books, eBooks, and videos for creative people

Home > Articles

  • Print
  • + Share This
This chapter is from the book

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()
  • copy(merge parameter value)
  • paste()
  • paste(intoSelection parameter value)
  • cut()

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

var newDocRef = app.documents.add(8, 6, 72, "New Doc")

Using the Copy Merged method

You can also perform a merged copy to copy of all visible layers in the selected area. In JavaScript, you must use the ArtLayer or Selection object’s copy() method with the merge parameter. To perform the merged copy, you must enter, or pass, the value true, as in the following example.


Look up the copy() method in the Methods table for the ArtLayer and Selection objects in Part 2 of this book.

  • + Share This
  • 🔖 Save To Your Account