• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script to rename artboard based on excel list or text doc

Community Beginner ,
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

2.8K

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 2 Correct answers

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

Votes

Translate

Translate
New Here , Dec 07, 2023 Dec 07, 2023

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!

Votes

Translate

Translate
Adobe
Community Expert ,
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

Votes

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
Community Beginner ,
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?

 

Votes

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
Community Expert ,
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.

Votes

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
Community Beginner ,
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

Votes

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
Community Expert ,
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?

Votes

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
Community Beginner ,
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.  

Votes

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
Community Expert ,
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);

 

 

Votes

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

Votes

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
Community Beginner ,
Mar 24, 2021 Mar 24, 2021

Copy link to clipboard

Copied

@femkeblanco  This is flawless, thanks

Votes

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 ,
Apr 03, 2023 Apr 03, 2023

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.

Votes

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
Community Expert ,
Apr 03, 2023 Apr 03, 2023

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. 

 

Votes

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 ,
Dec 07, 2023 Dec 07, 2023

Copy link to clipboard

Copied

LATEST

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!

Votes

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