Привет! На просторах интернета нашел скрипт который экспортирует из Иллюстратора PNG, SVG, JPG. Подскажите, пожалуйста, как в этот скрипт вписать еще экспорт в PDF, PSD и AI ? Пробовал варианты но не работает, моих знаний не достаточно
JavaScript:
#target Illustrator
/**
* This script will export an Illustrator file into multiple sizes of multiple file types.
* @author Mitch Talmadge ( https://MitchTalmadge.com )
*/
if (app.documents.length > 0) {
main();
} else {
Window.alert("Cancelled export.");
}
function main() {
var sizes = [1024, 512, 300, 256, 150, 100, 64, 50, 32, 16];
var document = app.activeDocument;
var afile = document.fullName;
var filename = afile.name.split('.')[0];
var svgFolder = new Folder(afile.parent.fsName + "/SVG");
if (!svgFolder.exists) {
svgFolder.create();
}
var pngFolder = new Folder(afile.parent.fsName + "/PNG");
if (!pngFolder.exists) {
pngFolder.create();
}
var jpgFolder = new Folder(afile.parent.fsName + "/JPG");
if (!jpgFolder.exists) {
jpgFolder.create();
}
Window.alert("Press OK to begin exporting.");
var size, file;
if (svgFolder != null) {
var options = new ExportOptionsSVG();
options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;
options.documentEncoding = SVGDocumentEncoding.UTF8;
options.fontType = SVGFontType.OUTLINEFONT;
options.fontSubsetting = SVGFontSubsetting.None;
options.preserveEditability = false;
options.embedRasterImages = true;
file = new File(svgFolder.fsName + '/' + filename + ".svg");
document.exportFile(file, ExportType.SVG, options);
}
if (pngFolder != null) {
var options = new ExportOptionsPNG24();
options.antiAliasing = false;
options.transparency = true;
options.artBoardClipping = true;
for (var i = 0; i < sizes.length; i++) {
size = sizes[i];
file = new File(pngFolder.fsName + '/' + filename + "-" + size + "px.png");
var scale = size / document.height;
if (scale <= 7.76) {
options.verticalScale = 100 * scale;
options.horizontalScale = 100 * scale;
document.exportFile(file, ExportType.PNG24, options);
} else {
Window.alert("Cannot scale to required size. Artboard too small.");
reopenDocument(document, afile);
return;
}
}
}
if (jpgFolder != null) {
var options = new ExportOptionsJPEG();
options.antiAliasing = false;
options.qualitySetting = 100;
options.optimization = true;
options.artBoardClipping = true;
for (var i = 0; i < sizes.length; i++) {
size = sizes[i];
file = new File(jpgFolder.fsName + '/' + filename + "-" + size + "px.jpg");
var scale = size / document.height;
if (scale <= 7.76) {
options.verticalScale = 100 * scale;
options.horizontalScale = 100 * scale;
document.exportFile(file, ExportType.JPEG, options);
} else {
Window.alert("Cannot scale to required size. Artboard too small.");
reopenDocument(document, afile);
return;
}
}
}
Window.alert("Images have been exported!");
reopenDocument(document, afile);
}
function reopenDocument(document, afile) {
document.close(SaveOptions.DONOTSAVECHANGES);
app.open(afile);
}