Adobe 65014293 Scripting Guide - Page 40

Linking layer objects, Applying styles to layers, or in the Visual Basic Object Browser.

Page 40 highlights

CHAPTER 3: Scripting Photoshop Working with the Photoshop Object Model 40 Linking layer objects Scripting also supports linking and unlinking layers. You link layers together so that you can move or transform the layers in a single statement. AS make new art layer in current document with properties {name:"L1"} make new art layer in current document with properties {name:"L2"} link art layer "L1" of current document with art layer "L2" of ¬ current document Look up the link command in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary. VBS Set layer1Ref = docRef.ArtLayers.Add() Set layer2Ref = docRef.ArtLayers.Add() layer1Ref.Link layer2Ref Look up Link in as a method of the ArtLayer object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser. Additionally, look up Add as a method of the ArtLayers object. JS var layerRef1 = docRef.artLayers.add() var layerRef2 = docRef.artLayers.add() layerRef1.link(layerRef2) Look up link() as a method of the ArtLayer object in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer. Additionally, look up add() as a method of the ArtLayers object. Applying styles to layers NOTE: This procedure corresponds directly to dragging a style from the Photoshop Styles palette to a layer. Your script can apply styles to an ArtLayer object. To apply a style in a script, you use the apply layer style/ApplyStyle/applyStyle() command with the style's name as an argument enclosed in straight double quotes. NOTE: The layer style names are case sensitive. Please refer to Photoshop Help for a list of styles and for more information about styles and the Styles palette. The following examples set the Puzzle layer style to the layer named "L1." AS apply layer style art layer "L1" of current document using "Puzzle (Image)" Look up the apply layer style command in the Adobe Photoshop CS4 AppleScript Scripting Reference or in the Photoshop AppleScript Dictionary. VBS docRef.ArtLayers("L1").ApplyStyle "Puzzle (Image)" Look up ApplyStyle as a method of the ArtLayer object in the Adobe Photoshop CS4 Visual Basic Scripting Reference, or in the Visual Basic Object Browser. JS docRef.artLayers["L1"].applyStyle("Puzzle (Image)") Look up applyStyle() as a method of the ArtLayer object in the Adobe Photoshop CS4 JavaScript Scripting Reference, or in the ExtendScript Object Model Viewer.

  • 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
  • 86
  • 87

C
HAPTER
3: Scripting Photoshop
Working with the Photoshop Object Model
40
Linking layer objects
Scripting also supports linking and unlinking layers. You link layers together so that you can move or
transform the layers in a single statement.
AS
make new art layer in current document with properties {name:"L1"}
make new art layer in current document with properties {name:"L2"}
link art layer "L1" of current document with art layer "L2" of ¬
current document
Look up the
link
command in the
Adobe Photoshop CS4 AppleScript Scripting Reference
or in the
Photoshop AppleScript Dictionary.
VBS
Set layer1Ref = docRef.ArtLayers.Add()
Set layer2Ref = docRef.ArtLayers.Add()
layer1Ref.Link layer2Ref
Look up
Link
in as a method of the
ArtLayer
object in the
Adobe Photoshop CS4 Visual Basic Scripting
Reference
, or in the Visual Basic Object Browser. Additionally, look up
Add
as a method of the
ArtLayers
object.
JS
var layerRef1 = docRef.artLayers.add()
var layerRef2 = docRef.artLayers.add()
layerRef1.link(layerRef2)
Look up
link()
as a method of the
ArtLayer
object in the
Adobe Photoshop CS4 JavaScript Scripting
Reference
, or in the ExtendScript Object Model Viewer. Additionally, look up
add()
as a method of the
ArtLayers
object.
Applying styles to layers
N
OTE
:
This procedure corresponds directly to dragging a style from the Photoshop Styles palette to a layer.
Your script can apply styles to an
ArtLayer
object. To apply a style in a script, you use the
apply layer
style/ApplyStyle/applyStyle()
command with the style’s name as an argument enclosed in straight
double quotes.
N
OTE
:
The layer style names are case sensitive.
Please refer to Photoshop Help for a list of styles and for more information about styles and the Styles
palette.
The following examples set the Puzzle layer style to the layer named “L1.”
AS
apply layer style art layer "L1" of current document using "Puzzle (Image)"
Look up the
apply
layer
style
command in the
Adobe Photoshop CS4 AppleScript Scripting Reference
or in
the Photoshop AppleScript Dictionary.
VBS
docRef.ArtLayers("L1").ApplyStyle "Puzzle (Image)"
Look up
ApplyStyle
as a method of the
ArtLayer
object in the
Adobe Photoshop CS4 Visual Basic Scripting
Reference
, or in the Visual Basic Object Browser.
JS
docRef.artLayers["L1"].applyStyle("Puzzle (Image)")
Look up
applyStyle()
as a method of the
ArtLayer
object in the
Adobe Photoshop CS4 JavaScript
Scripting Reference
, or in the ExtendScript Object Model Viewer.