Back to Uxp Photoshop

LayerComps

src/pages/ps_reference/classes/layercomps.md

2.2.02.6 KB
Original Source

LayerComps

A collections class allowing for array access into a document's Layer Comps

Access this collection through Document.layerComps property. For example, following adds a new Layer Comp to the collection:

javascript
const comp = await app.activeDocument.layerComps.add();

Indexable

▪ [index: number]: LayerComp

Used to access the Layer Comp in the collection

Access this collection through Document.layerComps property. For example, following adds a new Layer Comp to the collection:

javascript
const comp = await app.activeDocument.layerComps.add();

Properties

NameTypeAccessMin VersionDescription
lengthnumberR24.0Number of LayerComp elements in this collection
parentDocumentR24.0The owner document of this Layer comp collection
typenamestringR24.0The name for this object collection: LayerComps

Methods

add

<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">24.0</span>

Promise<LayerComp>

Adds a Layer Comp to the document's collection. If no options are given, only visibility will be recorded.

Note: This command will fail if the document is flat, that is, only a Background and no other layers.

Parameters

NameTypeDefault valueDescription
optionsLayerCompCreateOptions{}An optional object literal containing key/value pairs as described by LayerCompCreateOptions javascript const options = { name: "mockup", comment: "First attempt", visibility: true, position: true }; await require('photoshop').app.activeDocument.layerComps.add(options);

getAllByName

<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">24.0</span>

LayerComp[]

Get all Layer Comps by name

Parameters

NameType
namestring

removeAll

<span class="minversion" style="display: block; margin-bottom: -1em; margin-left: 36em; float:left; opacity:0.5;">24.0</span>

Promise<void>

Clears all Layer Comps from this collection