Copy link to clipboard
Copied
Hello,
I've been trying to get the below code to work from the post below, but I just can't figure it out....any ideas??
Error Code# 1200: an Illustrator error occurred: 1128353364 ('TNAC') @ file
var doc = app.documents[0];
var myFolder = activeDocument.path;
var assets = doc.assets;
var whatToExport = new ExportForScreensItemToExport();
whatToExport.artboards = '1-2';
whatToExport.document = true;
var jpegParam = new ExportForScreensOptionsJPEG();
jpegParam.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
jpegParam.progressiveScan = 4;
jpegParam.antiAliasing = AntiAliasingMethod.None;
jpegParam.embedICCProfile = true;
jpegParam.scaleType = ExportForScreensScaleType.SCALEBYWIDTH;
jpegParam.scaleTypeValue = 400;
path = new File(myFolder + "/" + "_thumbs" + ".jpg");
doc.exportForScreens(path, ExportForScreensType.SE_JPEG100, jpegParam, whatToExport, "JPEG100_");
Thanks in advance!
Regards,
Mike
Hi Mike,
Try the following script it will work
var doc = app.documents[0];
var myFolder = activeDocument.path;
var assets = doc.assets;
var whatToExport = new ExportForScreensItemToExport();
whatToExport.artboards = '1-2';
whatToExport.document = true;
var jpegParam = new ExportForScreensOptionsJPEG();
jpegParam.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
jpegParam.progressiveScan = 4;
jpegParam.antiAliasing = AntiAliasingMethod.None;
jpegParam.embedICCProfile = true;
jpegParam.sc
...
Copy link to clipboard
Copied
Hi Mike,
Try the following script it will work
var doc = app.documents[0];
var myFolder = activeDocument.path;
var assets = doc.assets;
var whatToExport = new ExportForScreensItemToExport();
whatToExport.artboards = '1-2';
whatToExport.document = true;
var jpegParam = new ExportForScreensOptionsJPEG();
jpegParam.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
jpegParam.progressiveScan = 4;
jpegParam.antiAliasing = AntiAliasingMethod.None;
jpegParam.embedICCProfile = true;
jpegParam.scaleType = ExportForScreensScaleType.SCALEBYWIDTH;
jpegParam.scaleTypeValue = 400;
var path1 = new File(myFolder + "/" + "_thumbs" + ".jpg");
doc.exportForScreens(path1, ExportForScreensType.SE_JPEG100, jpegParam, whatToExport);
The error that you have received may be of the following reasons
1. You don't have 2 artboards in the document as you mention artboards="1-2". Make sure to have two artboards.
2. Last parameter in the exportForScreens is not required.
I hope it help you.
Copy link to clipboard
Copied
Thank you! I'm not sure why it wasn't working as the document has 2 artboards and I tried removing the Last parameter in the exportForScreens, but it's working now.
Question: do you know why the "_thumbs" that's hard coded for the output file naming wouldn't be honored?? I had to create a work around by having the script rename the artboards before the export and rename the back afterwards.
Regards,
Mike
Copy link to clipboard
Copied
Hi Mike,
exportForScreens expect first parameter as exportFolder, where assets will be exported, that's why it won't consider _thumb.jpg name. But you can add the suffix to the exporte file by passing the string as a last parameter. See below code.
var doc = app.documents[0];
var myFolder = activeDocument.path;
var assets = doc.assets;
var whatToExport = new ExportForScreensItemToExport();
whatToExport.artboards = '1-2';
whatToExport.document = true;
var jpegParam = new ExportForScreensOptionsJPEG();
jpegParam.compressionMethod = JPEGCompressionMethodType.PROGRESSIVE;
jpegParam.progressiveScan = 4;
jpegParam.antiAliasing = AntiAliasingMethod.None;
jpegParam.embedICCProfile = true;
jpegParam.scaleType = ExportForScreensScaleType.SCALEBYWIDTH;
jpegParam.scaleTypeValue = 400;
var path1 = new File(myFolder);
doc.exportForScreens(path1, ExportForScreensType.SE_JPEG100, jpegParam, whatToExport, '_thumb_');
So, whatever will be exported from the above script will have _thumb_ as a prefix to the exported file.
Copy link to clipboard
Copied
Hello @Charu Rajput,
Yes, the last parameter adds _thumb_ as a prefix but how would you add it as the suffix?
Regards,
Mike
Copy link to clipboard
Copied
Hi all, I know this is an old thread, but I just got this exact same 'TNAC' error while using ExportForScreens. The reason for the error is that scaleTypeValue = 400 is out-of-bounds. ScaleTypeValue is a simple scale factor, so if you want 400% scale, use scaleTypeValue = 4.
- Mark