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

Script for adding a sequential number to multiple layer names in Illustrator 2020?

Explorer ,
Nov 28, 2019 Nov 28, 2019

Hi there

 

I was wondering if anyone knew of a script that would allow me to add a sequential numbering to multiple layers? i'm am working on files that have layers (some up to 200+) that are already named by their pantone refs, i have to organise them into their correct order and then add a sequential prefix of '1_', '2_' , '3_' etc (the underscore needed to seperate them from the numbers of the pantones) this is needed to be done from the bottom layer going up. I have included a screengrab of 10 layers to show you what i am currently doing manually, any help would be much appreciated as i have hundreds of artworks with hundreds of layers to sort and automation would literally save me weeks of time.

Screenshot 2019-11-28 at 11.46.59.pngexpand image

 

many thanks in advance

 

Nick

TOPICS
Scripting
5.7K
Translate
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
Explorer ,
Jun 13, 2021 Jun 13, 2021

#target illustrator

var doc = app.activeDocument;
var layerCount = doc.layers.length;
for (var j = 0; j < layerCount; j++) {
layer = doc.layers[j];
layer.name = j.toString() + "_" + layer.name;
}

Translate
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
Advocate ,
Jun 13, 2021 Jun 13, 2021

Salut!

"cela doit être fait à partir de la couche inférieure qui monte"

 

#target illustrator
var doc = app.activeDocument;
var layerCount = doc.layers.length;
for (var j = layerCount-1, k = 1;  j >= 0;  j--, k++) {
    var layer = doc.layers[j];
    layer.name = k + "_" + layer.name;
}

 

 

 

Translate
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
Explorer ,
Jun 13, 2021 Jun 13, 2021
LATEST
same thing in reverse

#target illustrator
var doc = app.activeDocument;var layerCount = doc.layers.length;for
(var j = 0; j < layerCount; j++) {
layer = doc.layers[layerCount-1-j];
layer.name = j.toString() + "_" + layer.name;
}

--
Adam Goddard | Video | Motion Graphics | Design
m. +61 402 966 860
e. adam@adamgoddard.com.au
www.adamgoddard.com.au
Please upload files to me using this link:
Upload files to Adam Goddard
Translate
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