• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JavaScript to find a specific Layer

Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

Hi all,

 

I have been looking into the scripting side of Illustrator and have been struggling to get my head around things.

 

I am trying to create a simple code that would find a layer by name/ID and change its content.

 

I can create a code to create a new layer, but I am struggling to modify this to allow me to change a layer that already exists.

 

 

 

Any help is greatly appreciated.

TOPICS
Scripting

Views

217

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guide ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

A layer named "Layer 1" is referenced as such

app.activeDocument.layers["Layer 1"]

 

For example, to lock layer "Layer 1"

app.activeDocument.layers["Layer 1"].locked = true;

 

Or, to remove all path items from layer "Layer 1"

app.activeDocument.layers["Layer 1"].pathItems.removeAll();

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 16, 2021 Jun 16, 2021

Copy link to clipboard

Copied

LATEST

Thanks so much for your quick response - will give this a go.

 

Thanks again

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines