Copy link to clipboard
Copied
Hi all,
THE CHALLENGE....
I import various Autocad drawings into Illustrator daily for packaging designs.
I need a java script to create 2 new layers, then name them as Dielines and ART.
I've tried the script below that creates 2 new layers but I'm not sure how to rename them?
The trial script below does not achieve a rename.
app.activeDocument.layers.add;
app.activeDocument.layers.getByName('Layer')rename.('Dieline');.
app.activeDocument.layers.add;
app.activeDocument.layers.getByName('Layer')rename.('Art');.
The Autocad drawings that are imported vary in the ammount of layers they contain.
Can ayone help as I'm sure there are lots of ways to achieve the result I want but I'm a newbie to this.
Many thanks in advance.
Hi,
I have updated the @femkeblanco script, add is the method therefore it must have () brackets after add. Here you go
var layer1 = app.activeDocument.layers.add();
layer1.name = 'Dieline';
var layer2 = app.activeDocument.layers.add();
layer2.name = 'Art';
Copy link to clipboard
Copied
var layer1 = app.activeDocument.layers.add;
layer1.name = 'Dieline';
var layer2 = app.activeDocument.layers.add;
layer2.name = 'Art';
Copy link to clipboard
Copied
Hi,
I have updated the @femkeblanco script, add is the method therefore it must have () brackets after add. Here you go
var layer1 = app.activeDocument.layers.add();
layer1.name = 'Dieline';
var layer2 = app.activeDocument.layers.add();
layer2.name = 'Art';
Copy link to clipboard
Copied
Oops. Thanks.
Copy link to clipboard
Copied
thankyou Femkeblanco This works well 🙂
Copy link to clipboard
Copied
Hello, I'm a newbie as well. Think I can make use of this script, if i only new how to actually download it and where to actaully place it then run it. Any guidance will be GREATLY! appreaciated. Thanks
Copy link to clipboard
Copied
Hola rubia, copy the script posted here, paste it in a Text Editor, save it with any name with a "*.jsx" extension.
Make sure you save as Plain Text (NOT Rich Text).
Then go to Illustrator, open a document and click on File->Scripts->Other Scripts...find the script you just saved, done.