Change artboard name to file name

New Here ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

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!

TOPICS
How to , Import and export , Scripting , Sync and storage

Views

51

Likes

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
Advocate ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

LATEST

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

Likes

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
Component error Component didn't load. Please try again later.