Skip to main content
Known Participant
Aug 29, 2014 7:36 PM UTC
Answered

Illustrator Script to Rename Artboards based on Artboard Size

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 is closed to new replies. Start a new post to keep the conversation going.
pixxxelschubser
pixxxelschubserCorrect answer
Community Expert
Aug 29, 2014 9:01 PM UTC

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

10 replies

Participant
Oct 26, 2022 3:19 PM UTC

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

Translate
CarlosCanto
Community Expert
Community Expert
Oct 26, 2022 3:24 PM UTC

most likely it won't work in Photoshop

Translate
Participant
Apr 11, 2018 2:55 PM UTC

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

Translate
ericsoupAuthor
Known Participant
Dec 3, 2014 8:04 PM UTC

A much delayed thank you.  This worked great. 

Translate
pixxxelschubser
Community Expert
Community Expert
Dec 4, 2014 1:18 AM UTC

Better late than never …

You're welcome.

Translate
pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
Aug 29, 2014 9:01 PM UTC

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

Translate
pixxxelschubser
Community Expert
Community Expert
Apr 11, 2018 6:00 PM UTC

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

Translate
Participant
Apr 12, 2018 6:48 AM UTC

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

Translate