Skip to main content
Participant
August 5, 2022
Question

Change artboard name to file name

  • August 5, 2022
  • 1 reply
  • 1134 views

I need to stack process 900+ .ai files so that the artboards become renamed after the file itself.

There are a ton of direction if you want to name a file after its artboard but not the way around.

 

Thanks for the effort!

This topic has been closed for replies.

1 reply

Legend
August 6, 2022

hello @UXexplorer,

 

Give the below script a try... just run the script on the folder that contains your files.

 

var main = function() {

var myDirectory = Folder.selectDialog("Select files folder");
var files = myDirectory.getFiles(/.(ai|eps)$/i);

for(var f = 0; f < files.length; f++){
 var doc = app.open(files[f]);
 var myDocName = doc.name;

for(var a = 0; a < doc.artboards.length; a++) {
  doc.artboards.setActiveArtboardIndex(a);
    doc.artboards[a].name = myDocName + "_" + (a+1);  
      artboardName = doc.artboards[a].name.toString();
  }
  app.activeDocument.close(SaveOptions.SAVECHANGES);
 }
 alert("Done renaming Artboards on " + files.length + " files!")
}
main();

 

Regards,

Mike

Inspiring
February 20, 2024

Hi

 

This looks like the script that I need - but where do I run it from? Inside Illustrator? I'm getting an error there (a yellow triangle with exclamation mark, no words)

 

Cheers

 

R

renél80416020
Inspiring
February 20, 2024

Ce script fonctionne.

copiez le texte

puis enregistrez sous le nom de votre choix.js

puis dans Illustrator

<CTRL>+F12

....