Adobe PHOTOSHOP CS 2.0 - SCRIPTING GUIDE Manual page 56

Table of Contents

Advertisement

Adobe Photoshop CS2 Scripting Guide
Note:
Unlike object references in JavaScript or VBScript, AppleScript object reference names do not
remain constant. Refer to an AppleScript language guide or text book for information on
referencing a file using either
VBS
Layers("Layer 3").Select
JS
layers["Layer 3"].select() //using the collection name and square brackets for the
collection
Working with Layer Set Objects
Existing layers can be moved into layer sets. The following examples show how to create a
object, duplicate an existing
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
VBS
In VBScript you must duplicate and place the layer.
Set layerSetRef = docRef.LayerSets.Add
Set layerRef = docRef.ArtLayers(1).Duplicate
layerSetRef.Move appRef, 0 'for psElementPlacement --> 0 psPlaceAtEnd
layerRef.MoveToEnd layerSetRef
JS
In JavaScript you must duplicate and place the layer.
var layerSetRef = docRef.layerSets.add()
var layerRef = docRef.artLayers[0].duplicate(layerSetRef,
ElementPlacement.PLACEATEND)
layerRef.moveToEnd (layerSetRef)
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 ¬
Photoshop CS2
or
as alias
to a reference to file
object, and move the duplicate object into the layer set.
ArtLayer
Scripting Photoshop CS2
.
Layer Set
52

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Photoshop cs2

Table of Contents