Adobe 23101764 Scripting Guide - Page 78

Set newLayerSetRef = appRef.ActiveDocument.LayerSets.Add

Page 78 highlights

Scripting Photoshop 3 Layer objects The following examples show how to create a layer set after the first layer in the current document: AS: tell application "Adobe Photoshop CS" make new layer set after layer 1 of current document end tell VB: Dim appRef As Photoshop.Application Set appRef = CreateObject("Photoshop.Application") ' Get a reference to the first layer in the document Dim layerRef As Photoshop.Layer Set layerRef = appRef.ActiveDocument.Layers(1) ' Create a new LayerSet (it will be created at the beginning of the ' document) Dim newLayerSetRef As Photoshop.LayerSet Set newLayerSetRef = appRef.ActiveDocument.LayerSets.Add ' Move the new layer to after the first layer newLayerSetRef.Move layerRef, psPlaceAfter JS: // Get a reference to the first layer in the document var layerRef = app.activeDocument.layers[0]; // Create a new LayerSet (it will be created at the beginning of the // document) var newLayerSetRef = app.activeDocument.layerSets.add(); // Move the new layer to after the first layer newLayerSetRef.move(layerRef, ElementPlacement.PLACEAFTER); An existing art layer can also be changed to a text layer if the existing layer is empty. Conversely you can change a text layer to a normal layer. When you do this the text in the layer is rasterized. Photoshop CS Scripting Guide 74

  • 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
74
Scripting Photoshop
Layer objects
3
The following examples show how to create a layer set after the
rst layer in the current
document:
AS:
tell application "Adobe Photoshop CS"
make new layer set after layer 1 of current document
end tell
VB:
Dim appRef As Photoshop.Application
Set appRef = CreateObject("Photoshop.Application")
' Get a reference to the first layer in the document
Dim layerRef As Photoshop.Layer
Set layerRef = appRef.ActiveDocument.Layers(1)
' Create a new LayerSet (it will be created at the beginning of the
' document)
Dim newLayerSetRef As Photoshop.LayerSet
Set newLayerSetRef = appRef.ActiveDocument.LayerSets.Add
' Move the new layer to after the first layer
newLayerSetRef.Move layerRef, psPlaceAfter
JS:
// Get a reference to the first layer in the document
var layerRef = app.activeDocument.layers[0];
// Create a new LayerSet (it will be created at the beginning of the
// document)
var newLayerSetRef = app.activeDocument.layerSets.add();
// Move the new layer to after the first layer
newLayerSetRef.move(layerRef, ElementPlacement.PLACEAFTER);
An existing art layer can also be changed to a text layer if the existing layer is empty.
Conversely you can change a text layer to a normal layer. When you do this the text in the
layer is rasterized.