Skip to main content
Turan Ramazanli
New Participant
July 4, 2024
Question

Script to save multiple artboards as separate eps files without using 'Use Artboards' option

  • July 4, 2024
  • 1 reply
  • 397 views

Hello everyone!

I need a script for Illustrator to save multiple artboards as separate EPS files without using the 'Use Artboards' option. Sometimes I have more than 30 artboards with icons or logos, and as a stock contributor, I need to save them separately without using the 'Use Artboards' option. This would be a huge time-saver for me!

Thank you!

This topic has been closed for replies.

1 reply

GerssonDelgado
Inspiring
July 4, 2024

 @Turan Ramazanli   check out this!

 

/**
 * @name SaveEPSScript
 * @version 1.0.0
 * @description Saves the active document as EPS in a new folder
  https://community.adobe.com/t5/illustrator-discussions/script-to-save-multiple-artboards-as-separate-eps-files-without-using-use-artboards-option/m-p/14718920#M412087
  
 */

(function() {
    // verificar si hay documento abierto
    if (!documents.length) {
        alert("Debes abrir un documento", "Script Error !!", true);
        return;
    }

    var doc = app.activeDocument;
    var docPath = doc.path.fsName;
    var newFolderName = 'Files';
    var newFolderPath = docPath + '/' + newFolderName;

    function createFolder(folderPath) {
        var newFolder = new Folder(folderPath);
        if (!newFolder.exists) {
            return newFolder.create();
        }
        return false;
    }

    function saveAsEPS(document, savePath) {
        var fileName = document.name.replace(/\.[^\.]+$/, '');
        var epsOptions = new EPSSaveOptions();
        epsOptions.cmykPostscript = true;
        epsOptions.compatibilityFormat = Compatibility.ILLUSTRATOR8;
        epsOptions.compatibleGradientPrinting = false;
        epsOptions.embedAllFonts = true;
        epsOptions.embedLinkedFiles = true;
        epsOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
        epsOptions.includeDocumentThumbnails = true;
        epsOptions.overprint = PDFOverprint.PRESERVEPDFOVERPRINT;
        epsOptions.postScript = EPSPostScriptLevelEnum.LEVEL2;
        epsOptions.preview = EPSPreview.COLORTIFF;
        epsOptions.saveMultipleArtboards = true;

        var saveFile = new File(savePath + "/" + fileName + ".eps");
        document.saveAs(saveFile, epsOptions);
    }

    function showErrorDialog() {
        var errorWindow = new Window("dialog", "Detalle de Error");
        var panel = errorWindow.add("panel");
        var group = panel.add("group");
        group.orientation = "column";
        group.add("statictext", undefined, "\u274c Folder ya existe!");
        group.add("button", undefined, "Ok");
        errorWindow.show();
    }

    // Ejecutar Script
    if (createFolder(newFolderPath)) {
        saveAsEPS(doc, newFolderPath);
        doc.close(SaveOptions.DONOTSAVECHANGES);
    } else {
        showErrorDialog();
    }

})();