Copy link to clipboard
Copied
I am unable to find a script that will do this. The default application functionality is really frustrating how it just slaps a generic "Layer 1", "Layer 2" layer name on the new layers. I would rather have the name of the sublayer become the name of the new layer. Has anyone seen a script anywhere that does this?
you need to copy and paste the code into any text editor and save it as jsx
Installing scripts in the Scripts menu
To include a script in the Scripts menu (File > Scripts), save the script in the Scripts folder, located in the
/lllustrator CC/Presets folder in your lllustrator CC installation directory. The script’s filename, minus
the file extension, appears in the Scripts menu.
Scripts that you add to the Scripts folder while Illustrator is running do not appear in the Scripts menu until
the next ti
...Copy link to clipboard
Copied
I'm confused, can you post a screen shot showing your layer structure (with default "layer #" names) and how you want it renamed?
Copy link to clipboard
Copied
See the image below.
Copy link to clipboard
Copied
cool, I'll work on something tonight after work.
Copy link to clipboard
Copied
here you go, select "Layer 1" and apply Release to Layers (sequence) before running
var idoc = app.activeDocument;
var ilayer = idoc.activeLayer;
for (i=0; i<ilayer.layers.length; i++)
{
var sublayer = ilayer.layers[i];
sublayer.name = sublayer.pageItems[0].name;
}
Copy link to clipboard
Copied
Thanks! That helps a lot. I think I can add in whatever functionality I need from there.
Copy link to clipboard
Copied
Hi Carlos - I'm not a scripting person and no nothing of syntax. How do I put this script into action on a Mac (Yosemite) using Illustrator CC 2015? What app do I use to write the script? Thanks for the help!
Copy link to clipboard
Copied
you need to copy and paste the code into any text editor and save it as jsx
Installing scripts in the Scripts menu
To include a script in the Scripts menu (File > Scripts), save the script in the Scripts folder, located in the
/lllustrator CC/Presets folder in your lllustrator CC installation directory. The script’s filename, minus
the file extension, appears in the Scripts menu.
Scripts that you add to the Scripts folder while Illustrator is running do not appear in the Scripts menu until
the next time you launch Illustrator.
Any number of scripts can be installed in the Scripts menu. If you have many scripts, use subfolders in the
Scripts folder to help organize the scripts in the Scripts menu. Each subfolder is displayed as a separate
submenu containing the scripts in that subfolder.
Executing scripts from the Other Scripts menu item
The Other Scripts item at the end of the Scripts menu (File > Scripts > Other Scripts) allows you to execute
scripts that are not installed in the Scripts folder.
Selecting Other Scripts displays a Browse dialog, which you use to navigate to a script file. When you select
the file, the script is executed.
Copy link to clipboard
Copied
I keep getting the following error error 1302: no such element sublayer.name = sublayer.pageItems[0].name;
Any ideas?
Thanks
Copy link to clipboard
Copied
You have to release to layers first, then run that script.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
never mind, problem solved, thanks any way
Copy link to clipboard
Copied
I'm having and issue where nothing is happening. What solved your problem?
Copy link to clipboard
Copied
Thanks! Save so much time!
Copy link to clipboard
Copied
Thanks so much Carlos! For some reason I was never notified that there had been a response to my post from 5+ years ago and I just happened to stumble across this. Better late than never! Thanks again - that is definitely something Adobe should have built in years ago.
Copy link to clipboard
Copied
Hi kangyfeet, about time!! Lol
Copy link to clipboard
Copied
You're a lifesaver, Thank you so much..
Copy link to clipboard
Copied
Thank You so Much ... ❤️ its really helpful you are awesome
Copy link to clipboard
Copied
Copy link to clipboard
Copied
wow 10 years later...
what SV said, plus download it again, I just fixed the index issue.
Copy link to clipboard
Copied
10 years and 6 months later! Thank you so much for saving me from renaming 56 layers one at a time!
Copy link to clipboard
Copied
10 years later and it saves me times from renaming hundreds of assets again because I didn't know that it reset the naming, so thank you so much! Adobe should've implemented what seems like to be a basic QoL feature like this after all these years tbh.
Copy link to clipboard
Copied
AGREED! This script just made my life so much easier. Can't believe Adobe hasn't updated Illustrator to include this yet. Thank you all for sharing this info!
Copy link to clipboard
Copied
Thanks a lot Carlos!
I'm a bit lost, could anyone please point the url to download the updated script? I can't find it.
Copy link to clipboard
Copied
Copy and paste it in a jsx file. (You can create a txt file and change the extension to jsx.) Then, while your document is open in Illustrator, go to File > Scripts > Other Script (Ctrl+F12). Find your script and open it.