A SERVICE OF

logo

Photoshop CS3
Adobe Photoshop CS3 Scripting Guide Scripting Photoshop CS3 55
Set newDocRef = appRef.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 all visible layers in the selected area. In AppleScript, you use
the
copy merged command. For VBScript and JavaScript, you use the Copy/copy command, passing in a
value of
True/true for the optional merge parameter.
AS
Note: On Mac OS, Photoshop CS3 must be the front-most application when executing these commands.
You must use the
activate command to activate the application before executing any clipboard
commands.
set docRef to make new document
make new art layer of docRef
select all of docRef
copy merged selection of docRef
VBS
docRef.Selection.Copy True
Look up the Copy method for the ArtLayer and Selection objects in the Adobe Photoshop CS3 Visual
Basic Scripting Reference, or in the Visual Basic Object Browser
JS
docRef.selection.copy(true)
Look up the copy() method for the ArtLayer and Selection objects in the Adobe Photoshop CS3
JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer.
Working with Units
Photoshop CS3 provides two rulers for documents. Using properties on the settings-object
(
Preferences/Preferences) object, you can set the measurement units for the rulers in your script. The
rulers are:
A graphics ruler used for most graphical layout measurements or operations on a document where
height, width, or position are specified.
You set measurement unit types for the graphics ruler using the
ruler units
(RulerUnits/rulerUnits)
property.