0

I have an Illustrator file with several artboards as attached.

In particular I have an artboard that contains all the others. The other artboards concern the individual objects to be exported.

I need to export the coordinates of the artboards containing the objects to a file (csv, txt, etc.). The origin 0,0 is set in the top left vertex of the artboard that contains them all.

I think it's a pretty simple thing to do with a script but I don't know where to start.

Does anyone have suggestions?

enter image description here

  • Download the javascript reference and look up what artboard object has in it. – joojaa Jul 17 at 11:43
0

I did some tests and I think I found a solution with the following script. Essentially I did a loop to retrieve the values ​​from the artboardRect property and save them in csv.

I hope it's useful to someone :)

alert ('Artboard num: '+app.activeDocument.artboards.length);

//Open a new text file.
var myTextFile = File.saveDialog("Save CSV As", undefined);
//If the user clicked the Cancel button, the result is null.
if(myTextFile != null){
  //Open the file with write access.
  myTextFile.open("w");
  myTextFile.writeln('Artboard, x, y\n');

  for (i=0; i<app.activeDocument.artboards.length; i++) {
    // .. using each by indexed number
    // .. and what you want to know is
    // "artboardRect: Size and position of artboard"
    r = app.activeDocument.artboards[i].artboardRect;
    n = app.activeDocument.artboards[i].name;
    // now r holds the coordinates:
    //alert ('name:'+n+'\n x:'+r[0]+'\n y:'+ Math.abs(r[1]));
    myTextFile.writeln(n+','+r[0]+','+Math.abs(r[1])+'\n');
  }

  myTextFile.write("\r");
  myTextFile.close();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.