Script to rename artboard based on excel list or text doc

New Here ,
Mar 24, 2021 Mar 24, 2021

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. 

TOPICS
Scripting

Views

447

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Enthusiast , Mar 24, 2021 Mar 24, 2021
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; } }

Likes

translate

Translate

Translate
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

Hi @joshuab22185620 

For the beginning. (too little information and/or descriptions)

--> Illustrator forum search | Rename artboards script

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

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?

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

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.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

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

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

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?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

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.  

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 24, 2021 Mar 24, 2021

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);

 

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 24, 2021 Mar 24, 2021

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;
    }
}

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

@femkeblanco  This is flawless, thanks

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines