ExportForScreens keeps automatically appending numbers to end of export's file name (javascript)
Hi all!
Starting file: filename-thumbnail.ai, this file has multiple artboards. Each is named with the numbers 01, 02, 03....10, 11, 12, etc, until the end.
I'm trying to create a script to export all the artboards as individual pngs with a specific filename format of filename-artboardname-thumbnail
I almost have it but for some reason each file name is showing up as "filename-01-thumbnail01", "filename-02-thumbnail02". I've tried using slice(0,-2) but that results in "filename-01-thumbna01". I think it's automatically adding the artboard name to the end, but I'm not sure why, and how to stop it from doing so.
var doc = app.activeDocument;
var artboards = doc.artboards;
var fileFolder = doc.path;
//artboards.setActiveArtboardIndex(0);
var pngParam = new ExportForScreensOptionsPNG8();
pngParam.transparency = true;
pngParam.colorCount = 256;
var whatToExport;
//export each artboard individually
for (var i = 0; i < artboards.length; i++) {
whatToExport = new ExportForScreensItemToExport();
whatToExport.artboards = i + 1;
whatToExport.document = false;
doc.exportForScreens(new File(fileFolder + "/"), ExportForScreensType.SE_PNG8, pngParam, whatToExport, doc.name.replace("thumbnail.ai", artboards[i].name + "-thumbnail"));
}
