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

Illustrator script Rename selected multiple different artboards

Community Beginner ,
Jun 02, 2019 Jun 02, 2019

Copy link to clipboard

Copied

hello

I don't know how to write a script,

I want to find a script that can rename my selected artboard. Just like in the screenshot, just rename my selected artboards.

0602-3.png

TOPICS
Scripting

Views

1.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 1 Correct answer

Community Expert , Jun 03, 2019 Jun 03, 2019

Here you go (without any error management)

// set a new name eg "New Name" for the artboards Nr.?

var aDoc = app.activeDocument;

var which_artBoards_to_rename = prompt( "Rename Active Artboard" + "\n" + "Enter a number:", "2,3,5" ).split(",").join("");

for (i=0; i<which_artBoards_to_rename.length; i++) {

    abIdx = which_artBoards_to_rename*1 - 1;

    aDoc.artboards[abIdx].name = "New Name " + which_artBoards_to_rename; // set the new name here

    }

If that works for, try to understand

and have fun

Votes

Translate

Translate
Adobe
Community Expert ,
Jun 02, 2019 Jun 02, 2019

Copy link to clipboard

Copied

If you don't know - try to learn it.

But the names in your left screenshot are not standard. Do you already use a script for that?

For the beginning:

change the name of the active artboard:

// set a new name eg "New Name" for the active artboard

var aDoc = app.activeDocument;

var abIdx = aDoc.artboards.getActiveArtboardIndex ();

aDoc.artboards[abIdx].name = "New Name"; // set the new name here

//aDoc.artboards[abIdx].name = "new Name wharever";

---------------------

or

change the name of another artboard:

// set a new name eg "New Name" for the artboard Nr.?

var aDoc = app.activeDocument;

var which_artBoard_to_rename = 1; // set number of the artboard you want to change - should be 1 or higher; max = max number of artboards in your document

abIdx = which_artBoard_to_rename - 1;

aDoc.artboards[abIdx].name = "New Name"; // set the new name here

//aDoc.artboards[abIdx].name = "new Name wharever";

  • Do this for every artboard you want to change its name (or later work with loops or arrays)
  • Save your script as eg rename_artboard.jsx in your illustrator scripts folder.
  • Run or restart your Illustrator.
  • Open a file with multiple artboards and run your script rename_artboard from menu: File --> Scripts --> rename_artboard

Have fun

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

thank you very much

Yes, I used the renaming script in the forum before.

I am also trying to learn how to write scripts.

But it feels a bit difficult

like this?

// set a new name eg "New Name" for the artboard Nr.?

var aDoc = app.activeDocument;

var which_artBoard_to_rename = max; // 1;// set number of the artboard you want to change - should be 1 or higher; max = max number of artboards in your document

max = prompt( "Rename Active Artboard" + "\n" + "Enter a number:", "2,3,5" );

abIdx = which_artBoard_to_rename - 1;

aDoc.artboards[abIdx].name = "New Name"; // set the new name here

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

No.

It does not work in that way.

But I'm not at home yet.

The quickest way:

Take the second code snippet. Copy it two times.

Hardcode the number of the artboard you want change.

Set the number in line #3 to 2

... in the First copy to 3

... and in the second copy to 5

Save

and have fun

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

thanks for the reply

What I want is

A script file can automatically rename a randomly selected artboards

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

... and all of them with the same name?

Really?

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

Here you go (without any error management)

// set a new name eg "New Name" for the artboards Nr.?

var aDoc = app.activeDocument;

var which_artBoards_to_rename = prompt( "Rename Active Artboard" + "\n" + "Enter a number:", "2,3,5" ).split(",").join("");

for (i=0; i<which_artBoards_to_rename.length; i++) {

    abIdx = which_artBoards_to_rename*1 - 1;

    aDoc.artboards[abIdx].name = "New Name " + which_artBoards_to_rename; // set the new name here

    }

If that works for, try to understand

and have fun

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

Yeah

Thank you very much

This is what I want

I will try to learn and add some new features.

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 ,
Jun 03, 2019 Jun 03, 2019

Copy link to clipboard

Copied

// set a new name eg "New Name" for the artboards Nr.? 

var aDoc = app.activeDocument; 

var which_artBoards_to_rename = prompt( "Rename Active Artboard" + "\n" + "Enter a number:", "2,3,5" ).split(",").join(""); 

var renametext = prompt( "Rename Active Artboard" + "\n" + "Enter a name:", "Printing Category Name" )

for (i=0; i<which_artBoards_to_rename.length; i++) { 

    abIdx = which_artBoards_to_rename*1 - 1; 

    aDoc.artboards[abIdx].name ="0"+ which_artBoards_to_rename + "_"+ renametext ; // set the new name here 

    }

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 ,
Jan 08, 2021 Jan 08, 2021

Copy link to clipboard

Copied

LATEST

Unfortunately, switching to the new forum software destroyed most of the old scripts. Most of the time the counter in square brackets is missing.

 

Here is the fix for the last script shown on this thread:

// set a new name eg "New Name" for the artboards Nr.?  

var aDoc = app.activeDocument;  

var which_artBoards_to_rename = prompt( "Rename Active Artboard" + "\n" + "Enter a number:", "2,3,5" ).split(",").join("");  
var renametext = prompt( "Rename Active Artboard" + "\n" + "Enter a name:", "Printing Category Name" )

for (i=0; i<which_artBoards_to_rename.length; i++) {  
    abIdx = which_artBoards_to_rename[i]*1 - 1;  
    aDoc.artboards[abIdx].name ="0"+ which_artBoards_to_rename[i] + "_"+ renametext ; // set the new name here  
    } 

 

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