Copy link to clipboard
Copied
Is there a script out there for renaming sub-layers? I have a huge number of items to rename (to make a wordpress map plugin function) and I can't seem to find something current that actually works. Bonus if it can do prefix/suffix.
I have Illustrator CC 2020. I've tried every script I could find but nothing seems to work for sublayers and not sure if it's because I am not converting the top layer, but rather the <path> under the top layer or if the scripts are just out of date.
For example, chaging <path> to acre or better yet, acre1, acre2, acre3, etc.
 
var paths = app.activeDocument.pathItems;
for (var i = 0; i < paths.length; i++) {
if (paths[i].parent.name == "acre") { // container name
paths[i].name = "acre" + (i + 1); // path name
}
}
Copy link to clipboard
Copied
var paths = app.activeDocument.pathItems;
for (var i = 0; i < paths.length; i++) {
if (paths[i].parent.name == "acre") { // container name
paths[i].name = "acre" + (i + 1); // path name
}
}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This seems to be a "copy-error"
line 1 should begin with
var
and not with
ar
Copy link to clipboard
Copied
You are correct. It works perfectly!
Copy link to clipboard
Copied
You probably did a little mistake when copying and pasting the code, Julie.
There is a missing "v" at the beginning of the first line.
The script should work if you correct that.
Copy link to clipboard
Copied
You are correct. My mistake. It works perfectly!