[Scripting] Export each artboard as a JPG
Hello, I know you can select use multiple artboards for jpg export manually, but there doesn't seem to be a corresponding property in the DOM. I tried some of the solutions mentioned here, but I am still getting the full file for each export.
Here is my routine. Am I missing something?
var exportOptions = new ExportOptionsJPEG();
exportOptions.artboardClipping = true;
exportOptions.antiAliasing = false;
exportOptions.quality = 100;
var doc = activeDocument;
var outfol = Folder.desktop;
var type = ExportType.JPEG;
var dn = decodeURI(doc.name);
var dnrx = /\.ai$/gi;
var abs = doc.artboards;
var n = abs.length;
var i = 0;
var fname;
for (i; i < n; i++) {
fname = dn.replace(dnrx,"-" + "0" + (i+1).toString().slice(-2) + ".jpg");
abs.setActiveArtboardIndex(i);
doc.exportFile(File(outfol + "/" + fname), type, saveOptions);
}
doc.close(SaveOptions.DONOTSAVECHANGES);

