Copy link to clipboard
Copied
Hello, I want my artboard details on excel sheet like name, size, colour code, thumbnail of artboard. is there any way to do this in a single click. Please let me know.
Copy link to clipboard
Copied
Its a bit unclear what you want to do.
Do you have an artboard that you want to analyze and then populate a spreadsheet with data about the artboard?
Or do you have a speadsheet with data and you want to make an artboard according to that data?
Copy link to clipboard
Copied
Thanks for the Replay
Yes I have an artboard that i want to analyze and then populate a spreadsheet
Copy link to clipboard
Copied
ok thanks. that helps.
well, here are the artboard properties that you can access. unfortunately it doesnt have any native "size" properties like height or width. so you have to calculate those from the artboardRect property, like this:
var rect = myArtboard.artboardRect;
var abWidth = rect[2] - rect[0];
var abHeight = rect[1] - rect[3];
var abSize = abWidth + "x" + abHeight; // "690x720"
once youve gathered the data you need, you can write to a csv file that can be used with excel. heres a sample of that:
var csvText = abName + "," + abSize + "," + abColorCode + "," + abThumbnailPath;
var csvFile = new File("path/to/file.csv");
csvFile.open("a"); // open in append mode, so that the existing content is not overwritten
csvFile.writeln(csvText); //write the text to the file
csvFile.close(); //close the file. failure to do so may result in data loss or corruption
The above assumes you have populated the variables abName, abSize, abColorCode, and abThumbnailPath. However, im unsure what you mean by "colour code" of the artboard. artboards dont have any properties related to color. an artboard isnt artwork, rather its a slightly fancy container that illustrator uses to export discreet sections of the "drawing area".
Additionally, im not sure how to get an actual image thumbnail into a spreadsheet from an illustrator script, you could export a thumbnail image to a specific location, then print that location to the csv and then do some magic in excel to populate those cells with the image at the relevant location.
To export a thumbnail:
var abIndex = 0;
app.activeDocument.artboards.setActiveArtboardIndex(abIndex);
var myArtboard = app.activeDocument.artboards[abIndex];
var myArtboardName = myArtboard.name;
var outFileName = myArtboardName + ".png";
var outFilePath = "~/Desktop/" + outFileName;
var exportOptions = new ExportOptionsPNG24();
exportOptions.artBoardClipping = true;
exportOptions.antiAliasing = true;
exportOptions.transparency = true;
exportOptions.verticalScale = 10;
exportOptions.horizontalScale = 10;
app.activeDocument.exportFile(new File(outFilePath), ExportType.PNG24, exportOptions);
//now, you can use outFilePath to get the path of the exported file and print it to the csv file
hope this helps point you in the right direction.