Copiar vínculo al Portapapeles
Copiado
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
...Got it working. Here's code:
var idoc = app.activeDocument;
var ilayer = idoc.activeLayer;
for (i=0; i<ilayer.layers.length; i++)
{
var sublayer = ilayer.layers[i];
try {
sublayer.name = sublayer.pageItems[0].name;
}
catch(err) {
try {sublayer.name = sublayer.layers[0].name;
}
catch(err) {
alert(err);
}
}
}
Copiar vínculo al Portapapeles
Copiado
I'm confused, can you post a screen shot showing your layer structure (with default "layer #" names) and how you want it renamed?
Copiar vínculo al Portapapeles
Copiado
See the image below.
Copiar vínculo al Portapapeles
Copiado
cool, I'll work on something tonight after work.
Copiar vínculo al Portapapeles
Copiado
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;
}
Copiar vínculo al Portapapeles
Copiado
Thanks! That helps a lot. I think I can add in whatever functionality I need from there.
Copiar vínculo al Portapapeles
Copiado
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!
Copiar vínculo al Portapapeles
Copiado
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.
Copiar vínculo al Portapapeles
Copiado
I keep getting the following error error 1302: no such element sublayer.name = sublayer.pageItems[0].name;
Any ideas?
Thanks
Copiar vínculo al Portapapeles
Copiado
You have to release to layers first, then run that script.
Copiar vínculo al Portapapeles
Copiado
Copiar vínculo al Portapapeles
Copiado
never mind, problem solved, thanks any way
Copiar vínculo al Portapapeles
Copiado
I'm having and issue where nothing is happening. What solved your problem?
Copiar vínculo al Portapapeles
Copiado
Thanks! Save so much time!
Copiar vínculo al Portapapeles
Copiado
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.
Copiar vínculo al Portapapeles
Copiado
Hi kangyfeet, about time!! Lol
Copiar vínculo al Portapapeles
Copiado
You're a lifesaver, Thank you so much..
Copiar vínculo al Portapapeles
Copiado
Thank You so Much ... ❤️ its really helpful you are awesome
Copiar vínculo al Portapapeles
Copiado
Copiar vínculo al Portapapeles
Copiado
wow 10 years later...
what SV said, plus download it again, I just fixed the index issue.
Copiar vínculo al Portapapeles
Copiado
10 years and 6 months later! Thank you so much for saving me from renaming 56 layers one at a time!
Copiar vínculo al Portapapeles
Copiado
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.
Copiar vínculo al Portapapeles
Copiado
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!
Copiar vínculo al Portapapeles
Copiado
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.
Copiar vínculo al Portapapeles
Copiado
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.
Encuentra más inspiración, eventos y recursos en la nueva comunidad de Adobe
Explorar ahora