Link in Zwischenablage kopieren
Kopiert
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);
}
}
}
Link in Zwischenablage kopieren
Kopiert
I'm confused, can you post a screen shot showing your layer structure (with default "layer #" names) and how you want it renamed?
Link in Zwischenablage kopieren
Kopiert
See the image below.
Link in Zwischenablage kopieren
Kopiert
cool, I'll work on something tonight after work.
Link in Zwischenablage kopieren
Kopiert
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;
}
Link in Zwischenablage kopieren
Kopiert
Thanks! That helps a lot. I think I can add in whatever functionality I need from there.
Link in Zwischenablage kopieren
Kopiert
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!
Link in Zwischenablage kopieren
Kopiert
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.
Link in Zwischenablage kopieren
Kopiert
I keep getting the following error error 1302: no such element sublayer.name = sublayer.pageItems[0].name;
Any ideas?
Thanks
Link in Zwischenablage kopieren
Kopiert
You have to release to layers first, then run that script.
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
never mind, problem solved, thanks any way
Link in Zwischenablage kopieren
Kopiert
I'm having and issue where nothing is happening. What solved your problem?
Link in Zwischenablage kopieren
Kopiert
Thanks! Save so much time!
Link in Zwischenablage kopieren
Kopiert
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.
Link in Zwischenablage kopieren
Kopiert
Hi kangyfeet, about time!! Lol
Link in Zwischenablage kopieren
Kopiert
You're a lifesaver, Thank you so much..
Link in Zwischenablage kopieren
Kopiert
Thank You so Much ... ❤️ its really helpful you are awesome
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
wow 10 years later...
what SV said, plus download it again, I just fixed the index issue.
Link in Zwischenablage kopieren
Kopiert
10 years and 6 months later! Thank you so much for saving me from renaming 56 layers one at a time!
Link in Zwischenablage kopieren
Kopiert
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.
Link in Zwischenablage kopieren
Kopiert
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!
Link in Zwischenablage kopieren
Kopiert
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.
Link in Zwischenablage kopieren
Kopiert
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.
Weitere Inspirationen, Events und Ressourcen finden Sie in der neuen Adobe Community
Jetzt ansehen