Specifications

Table Of Contents
Adobe Photoshop CS6
JavaScript Scripting Reference JavaScript Object Reference 128
Layers
The collection of layer objects, including ArtLayer and LayerSet objects, in the document. Access through
Document
.layers, or the LayerSet.layers collections properties.
For example, this uses the
length property to count the number of layer objects in the active document,
then displays the number on the screen:
var layerNum = app.activeDocument.layers.length
alert(layerNum)
Properties
Methods
Property Value type What it is
length
number
Read-only. The number of elements in the layers
collection.
parent
Document or
LayerSet
Read-only. The containing document or layer set.
typename
string
Read-only. The class name of the referenced layers object.
Method Parameter type Returns What it does
getByName
(name)
string
Layer
Gets the first element in the layers
collection with the provided name.
removeAll
()
Removes all layers from the collection.