3 Replies Latest reply: Oct 12, 2011 11:38 AM by booyajamo RSS

    [JS][CS4] - Setting up an if statement based on artboard size

    booyajamo Community Member

      Hello,

       

      I thought this would be relatively easy but I can't seem to figure out how to correctly set-up my if/else statement. I want to say, "If the artboard size is equal to these coordinates (0,792,1224,0), do xyz." Below is the code I have that doesn't seem to be working.  Just so I could try to get it working I'm having it export a JPEG, but that doesn't really matter since once I have it working I will have several conditions, so that if I have a document with several artboards I can tell different artboards to do different things based on what the size is. Any help is greatly appreciated. Let me know if osmething doesn't make sense.

       

      var doc = app.activeDocument;
      
      if(doc.artboards[0.artboardRect == [0,792,1224,0]){
      
      var destJPG = new File ("D:/Checkout/" + doc.name.split(".ai")[0] + ".jpg");
      var exportOptions = new ExportOptionsJPEG();
      var type = ExportType.JPEG;
      exportOptions.artBoardClipping = true;
      exportOptions.qualitySetting = 100;
      doc.exportFile(destJPG, type, exportOptions);
      
      }