Copy link to clipboard
Copied
I was wondering if it is possible to create a script that renames the artboards based on an excel, or text file. Instead of having to double-click and type out each name. I hope this makes sense.
2 Correct answers
var file1 = File.openDialog("Select text file", "*.txt");
file1.open("e");
var contents1 = file1.read();
file1.close();
var contents2 = contents1.split("\n");
for (var i = 0; i < app.activeDocument.artboards.length; i++) {
if (contents2[i]) {
app.activeDocument.artboards[i].name = contents2[i];
}
else {
alert( "You have too few names." );
break;
}
}
Hi! I am new to using scripts... I keep getting the alert "You have too few names." But I'm not sure what to change to fix that. I tried having the same number of artboards as my end goal (and the number of lines in my text file)... but... I'm not sure how to understand where my error is. Any suggestions would be much appreciated!
Explore related tutorials & articles
Copy link to clipboard
Copied
For the beginning. (too little information and/or descriptions)
Copy link to clipboard
Copied
@pixxxelschubser sorry i dont really know how to explain it.
I have a list of names in an excel sheet, and i want Illustrator to take those names and apply them to the names of the artboards in illustrator in the order they are. Is that possible?
Copy link to clipboard
Copied
Yes. It is possible.
You can check a few of the answered threads in the link that I have posted before.
I am very sure you will find something suitable there already.
Copy link to clipboard
Copied
I found something that works, it doesn't do exactly what I was hoping, but it is a start. It just brings up a dialog box for me to type in the name, which is faster than double-clicking each artboard but would still like to see if someone could come up with a script for this.
Thanks
Copy link to clipboard
Copied
Like a wrote before: "… too little information and/or descriptions…"
Give us an example list (CSV or TXT) an example file (AI) and/or a screenshot of your Artboards Panel.
Do you have experience writing scripts yourself? Do you need only help with scripting? For this, the Forum is here. Or do you need someone to write the script entirely for you?
Copy link to clipboard
Copied
I have a little experience, but not enough to anything like this.
I already fixed it on the project i wanted it for, but would the script have to be specific to each project? or could you somehow get the number of artboards (X) and then grab X number of lines from the file and then apply the lines as the names?
I'll attach what i wanted it for. I attached the artboard panel screenshot, and then the txt file i wanted it to grab from.
Copy link to clipboard
Copied
There is no screenshot available and no ai sample to test.
And yes, this is the general way the script should be programmed.
For example, you can find the number of artboards with:
var aDoc = app.activeDocument;
alert (aDoc.artboards.length);
Copy link to clipboard
Copied
var file1 = File.openDialog("Select text file", "*.txt");
file1.open("e");
var contents1 = file1.read();
file1.close();
var contents2 = contents1.split("\n");
for (var i = 0; i < app.activeDocument.artboards.length; i++) {
if (contents2[i]) {
app.activeDocument.artboards[i].name = contents2[i];
}
else {
alert( "You have too few names." );
break;
}
}
Copy link to clipboard
Copied
@femkeblanco This is flawless, thanks
Copy link to clipboard
Copied
I would love to use this but I do not know how to take the script text and make that work ans a working script.
Copy link to clipboard
Copied
Take the text from the message from femkeblanco and paste it into a new file in a text editing application. Save as a plain text file called rename artboards. (Make sure it is plain text and put into the script folder in your Users/ your name folder.) To run the script, restart AI and access through the file/scripts/other scripts.
Copy link to clipboard
Copied
Hi! I am new to using scripts... I keep getting the alert "You have too few names." But I'm not sure what to change to fix that. I tried having the same number of artboards as my end goal (and the number of lines in my text file)... but... I'm not sure how to understand where my error is. Any suggestions would be much appreciated!
Copy link to clipboard
Copied
Is it possible to use a similar code for Photoshop? I want to change the names of multiple artboards using a .csv.
Please and thank you!!

