Adobe 23102480 Scripting Guide - Page 55

Using the Copy Merged Command/Method, Working with Units

Page 55 highlights

Adobe Photoshop CS3 Scripting Guide Photoshop CS3 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.

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85

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.