JavaScript Scripting Reference
Layers
The collection of layer objects, including
Note:
Because the
you use the property name,
example uses the
then displays the number on the screen:
var layerNum = app.activeDocument.layers.length
alert(layerNum)
The following example uses an upper case L, which is incorrect:
var layerNum = app.activeDocument.Layers.length
alert(layerNum)
Properties
Property
length
parent
typename
Methods
Method
index
(itemKey)
getByName
(name)
removeAll
()
Adobe Photoshop CS3
ArtLayer
object is a property of the
Layers
, rather than the class name,
layers
property to count the number of
length
Value Type
number (long)
object (document
or layerSet)
string
Parameter Type
number
string
and
LayerSet
objects, in the document.
Document
object (as well as several other objects),
layer
What it is
Read-only. The number of elements in the
collection.
Read-only. The
layers
Read-only. The class name of the referenced
Returns
What it does
Gets an element from the collection.
object(Layer)
Gets the first element in the
Layer
collection with the provided name.
Removes all layers from the collection.
JavaScript Object Reference
, in your code. The following
Layers
objects in the active document,
layers
object's container.
layers
layers
127
object.