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

Simple Illustrator Script to Lock all Layers

New Here ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

Hi, I'd like to make a script in illustrator that can lock all layers in the document. I don't know javascript very well, so I'm not sure where to begin. I found this part of a script that will lock every other layer, but I really just need the script to lock every single layer. Any thoughts?

 

 

 

var aDoc = app.activeDocument;


var lc = aDoc.layers.length;
for (var i = 2; i <= lc; i+=2) {
    var curLayer = lc - i
    aDoc.layers[curLayer].locked = true;
}

 

 

TOPICS
Scripting

Views

706

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

correct answers 1 Correct answer

Community Expert , Oct 22, 2021 Oct 22, 2021

Hi,

Try following

var aDoc = app.activeDocument;
var lc = aDoc.layers.length;
for (var i = 0; i < lc; i++) {
    aDoc.layers[i].locked = true;
}

 

 

Votes

Translate

Translate
Adobe
Participant ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

try this 

 

var doc=app.activeDocument;
 for (i = 0; i < doc.layers.length; i++) {
          doc.layers[i].locked = true;
          }

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 Expert ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

Hi,

Try following

var aDoc = app.activeDocument;
var lc = aDoc.layers.length;
for (var i = 0; i < lc; i++) {
    aDoc.layers[i].locked = true;
}

 

 

Best regards

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
New Here ,
Oct 22, 2021 Oct 22, 2021

Copy link to clipboard

Copied

LATEST

Thank you so much!!

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