5 Replies Latest reply on Dec 16, 2014 10:30 AM by djbgraphicdesign

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

    djbgraphicdesign Level 1

      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] );   



      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!