Adobe 23101764 Scripting Guide - Page 79

Setting the Active layer, Layer sets

Page 79 highlights

Scripting Photoshop 3 Layer objects 3.10.1 Setting the Active layer Before attempting to manipulate a layer you must first select it. You can do this by setting the current layer (ActiveLayer/activeLayer) to the one you want to manipulate. AS: set current layer of current document to layer "Layer 1" of ¬ current document VB: docRef.ActiveLayer = docRef.Layers("Layer 1") JS: docRef.activeLayer = docRef.layers["Layer 1"]; 3.10.2 Layer sets Existing layers can be moved into layer sets. The following examples show how to create a layer set, duplicate an existing layer, and move the duplicate layer into the layer set. AS: set current document to document "My Document" set layerSetRef to make new layer set at end of current document set newLayer to duplicate layer "Layer 1" of current document¬ to end of current document move newLayer to end of layerSetRef In AppleScript, you can also duplicate a layer directly into the destination layer set. set current document to document "My Document" set layerSetRef to make new layer set at end of current document duplicate layer "Layer 1" of current document to end of layerSetRef Photoshop CS Scripting Guide 75

  • 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
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105

Photoshop CS Scripting Guide
75
Scripting Photoshop
Layer objects
3
3.10.1
Setting the Active layer
Before attempting to manipulate a layer you must
rst select it. You can do this by setting the
current layer (ActiveLayer/activeLayer)
to the one you want to manipulate.
AS:
set current layer of current document to layer "Layer 1" of ¬
current document
VB:
docRef.ActiveLayer = docRef.Layers("Layer 1")
JS:
docRef.activeLayer = docRef.layers["Layer 1"];
3.10.2
Layer sets
Existing layers can be moved into layer sets. The following examples show how to create a
layer set, duplicate an existing layer, and move the duplicate layer into the layer set.
AS:
set current document to document "My Document"
set layerSetRef to make new layer set at end of current document
set newLayer to duplicate layer "Layer 1" of current document¬
to end of current document
move newLayer to end of layerSetRef
In AppleScript, you can also duplicate a layer directly into the destination layer set.
set current document to document "My Document"
set layerSetRef to make new layer set at end of current document
duplicate layer "Layer 1" of current document to end of layerSetRef