Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual page 71

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
Using the Copy and Paste Commands/Methods
The following examples copy the contents an the background layer to the clipboard, create a new
document, and then paste the clipboard contents to the new document. The scripts assume that there is a
document already open in Photoshop CS2 and that the document has a background layer.
Note:
If your script creates a new document in which you paste the clipboard contents, be sure the
document uses the same ruler units as the original document. See
Preferences' on page 46
AS
Note:
On Mac OS, Photoshop CS2 must be the front-most application when executing these commands.
You must use the
commands.
tell application "Adobe Photoshop CS2"
activate
select all of current document
set current layer of current document to layer "Background" of ¬
current document
set newDocRef to make new document
past newDocRef
Note:
In AppleScript, you must select the entire layer before performing the copy.
VBS
//make firstDocument the active document
Set docRef = appRef.ActiveDocument
appRef.docRef.ArtLayers("Background").Copy
Set newDocRef = Documents.Add(8, 6, 72, "New Doc")
newDocRef.Paste
JS
//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 Command/Method
You can also perform a merged copy to copy of all visible layers in the selected area.
AS
Note:
On Mac OS, Photoshop CS2 must be the front-most application when executing these commands.
You must use the
commands.
activate
select all of current document
copy merged selection of current document
Photoshop CS2
for information.
command to activate the application before executing any clipboard
activate
command to activate the application before executing any clipboard
activate
Scripting Photoshop CS2
'Setting Application
67

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents