Adobe 23101764 - Photoshop CS - PC Manual page 78

Scripting guide
Hide thumbs Also See for 23101764 - Photoshop CS - PC:
Table of Contents

Advertisement

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.
74
Photoshop CS Scripting Guide

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs

Table of Contents