Save for web in Illustrator script
I made an Illustrator script to batch resize and center JPG pictures.
I would like to export the files by sticking it to artboard while keeping a 96 DPI.
The classical export as JPG recorded script works, but the size of the picture is based on DPI while it should be the same dimension as the artboard.
I recorded another script with Export for web action, but I need to confirm the export for each picture while I have DONTDISPLAYALERTS.
Now I found a direct way to add this action to the script, but apparently it only works with Photoshop:
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var saveFile = File(Folder.desktop + "/" + Name + ".jpg");
if(saveFile.exists){
if(!confirm("Overwrite existing document?")) return;
saveFile.remove();
}
SaveForWeb(saveFile,100); //change to 60 for 60%
}
main();
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
sfwOptions.format = SaveDocumentType.JPEG;
sfwOptions.includeProfile = false;
sfwOptions.interlaced = 0;
sfwOptions.optimized = true;
sfwOptions.quality = jpegQuality; //0-100
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
}
Would you know which Illustrator function can replace ExportOptionsSaveForWeb() ?
Thank you !
