Edit in GitHubLog an issue

Layers

A collections class allowing for array access into the applications list of layers on a document, while also providing familiar methods from ExtendScript, like getByName

Copied to your clipboard
1// Iterate through all the top layers of frontmost document
2app.activeDocument.layers.forEach(h => console.log(h.name));

Indexable

▪ [index: number]: Layer

Used to access the layers in the collection.

Copied to your clipboard
1// Iterate through all the top layers of frontmost document
2app.activeDocument.layers.forEach(h => console.log(h.name));

Properties

NameTypeAccessMin VersionDescription
length
number
R
22.5
Number of Layer elements in this collection.
typename
string
R
22.5
The name for this object collection: Layers.

Methods

add

22.5

async : Promise<Layer>

Create a new layer.

Copied to your clipboard
let newDoc1 = await app.activeDocument.layers.add();

getByName

22.5

Layer

Find the first layer with the matching name.

Parameters

NameType
name
string
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2023 Adobe. All rights reserved.