Skip to main content
Known Participant
August 29, 2014
Answered

Illustrator Script to Rename Artboards based on Artboard Size

  • August 29, 2014
  • 4 replies
  • 2896 views

Hi there,

I was wondering if anyone has a script they'd like to share which would rename all artboards in a document with their size?

Thanks


Eric

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi ericsoup,

This works for your artboard[0]

var AB = app.activeDocument.artboards[0];

var ABR = AB.artboardRect;

AB.name = (ABR[2] - ABR[0]).toFixed(3) + " points  × " + (ABR[1] - ABR[3]).toFixed (3) + " points";

All you have to do is to add a loop through your artboards.

Have fun

4 replies

Participant
October 26, 2022

Hello! Does anyone know if this will work for Photoshop? Many thanks

CarlosCanto
Community Expert
Community Expert
October 26, 2022

most likely it won't work in Photoshop

Participant
April 11, 2018

Anybody knows, how to do it with mm? And to all art bords?

ericsoupAuthor
Known Participant
December 3, 2014

A much delayed thank you.  This worked great. 

pixxxelschubser
Community Expert
Community Expert
December 4, 2014

Better late than never …

You're welcome.

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
August 29, 2014

Hi ericsoup,

This works for your artboard[0]

var AB = app.activeDocument.artboards[0];

var ABR = AB.artboardRect;

AB.name = (ABR[2] - ABR[0]).toFixed(3) + " points  × " + (ABR[1] - ABR[3]).toFixed (3) + " points";

All you have to do is to add a loop through your artboards.

Have fun

pixxxelschubser
Community Expert
Community Expert
April 11, 2018

Hi

https://forums.adobe.com/people/pixxxel+schubser  schrieb

Hi ericsoup ,

… All you have to do is to add a loop through your artboards.

Have fun

… and a little change for getting mm instead of points:

var aDoc = app.activeDocument;

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

    var AB = aDoc.artboards

    var ABR = AB.artboardRect; 

    AB.name = ((ABR[2] - ABR[0])*0.3527778).toFixed(1) + " mm  × " + ((ABR[1] - ABR[3])*0.3527778).toFixed (1) + " mm";

}

Have fun

Participant
April 12, 2018

Very very very thx, i love you man. =)