Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Working on a script that will add a new artboard and delete the old one if it is not a specific size

$
0
0

var docRef = app.activeDocument;

app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM; 

 

var ab = docRef.artboards[0];

 

if ((((ab.artboardRect[2] - ab.artboardRect[0]) / 72) == 17) && (((ab.artboardRect[1] - ab.artboardRect[3]) / 72) == 20)) {

// do nothing

}

                 

else {

 

docRef.artboards.add( [575,1601.78,1799,161.78] );   

docRef.artboards.remove(0);

 

var abIdx = docRef.artboards.getActiveArtboardIndex(); 

var actAbBds = docRef.artboards[abIdx].artboardRect;

}

 

I want to say it works about 90% of the time. I have no idea why it doesn't always work, sometimes it will build the other artboard even though it is the correct size and I have no idea why. It is very frustrating haha. If anyone has an idea why it won't always work, please let me know. Thanks in advance!


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>