Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

exportFile() broken when upgrading to Illustrator 2025

Explorer ,
May 23, 2025 May 23, 2025

I have a script I've been using for over a decade that just broke when I upgraded to Illustrator 2025.  I'm exporting the artboards to Photoshop files using exportFile() and this now throws an "Error 1200: Internal Error".  I rely this script nearly every day at work, so I had to roll illustrator back.  This is a very generic error, so no idea if this issue can be fixed.

TOPICS
Bug , Scripting
206
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 28, 2025 May 28, 2025

Hi @urbanstarship I've can reproduce the issue on my system here. Not sure if it is a bug, per se, but it is certainly not helpful behaviour.

 

In this case I would be inclined—rather than lodge a bug report—to put in a check in your code for an empty artboard before exporting. Here is a script that exports every artboard in the document, but only after checking if it's empty or not. The check is a bit of a hack, and destroys the current selection.

- Mark

 

/**
 * @file Export Every Artboard As 
...
Translate
Adobe
Community Expert ,
May 24, 2025 May 24, 2025

Hi @urbanstarship I wrote a quick test case and it worked fine on AI 29.5.1 (MacOS 15.5). Can you try it and see what happens?

- Mark

 

/**
 * @file Test Case For ExportFile As PSD.js
 * 
 * Saves active document's artboard 1 as "test"
 * into the same folder as the active document.
 * 
 * @author m1b
 * @version 2025-05-25
 */
(function () {

    var doc = app.activeDocument;

    if (!doc.fullName.exists)
        return alert('Please save this document first.');

    var exportOptions = new ExportOptionsPhotoshop();

    // export artboard 1
    doc.artboards.setActiveArtboardIndex(0);
    exportOptions.artboardRange = 1;

    exportOptions.antiAliasing = true;
    exportOptions.artBoardClipping = true;
    exportOptions.editableText = true;
    exportOptions.imageColorSpace = ImageColorSpace.CMYK;
    exportOptions.maximumEditability = true;
    exportOptions.resolution = 72;
    exportOptions.saveMultipleArtboards = true;
    exportOptions.warnings = false;
    exportOptions.writeLayers = true;

    var file = File(doc.fullName.parent + '/test.psd');

    doc.exportFile(file, ExportType.PHOTOSHOP, exportOptions);

    // reveal the exported file
    file.parent.execute();

})();

 

P.S. if this works for you, then the next step could be to try exporting to the same path that you are using in your real script. And then try adjusting the options so that this test case matches your real script, trying to narrow down thing that causes the failure in the latest Illustrator. Once we've locked it down, we can lodge a bug report.

 

Edit 2025-05-25: changed !doc.saved to !doc.fullName.exists as the test for a "saved" document.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 27, 2025 May 27, 2025

Error-1200.jpgIt's something to do with a change in how Illustrator handles exporting empty artboards, as I'm getting the 1200 error on my script and yours ONLY when there are empty artboards in my file.  I have multiple files with 100 artboards in them with logos on each artboard, and I always hide the particular logos I don't want to export and run my script.  Historically the default behaviour of exportFile() would ignore the artboards with nothing on them, and my workflow relied on that function to export only the logos I select.  Both scripts export the files in v2024 and in v2025, but stops with an error afterward in v2025 if any of the artboards are empty.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 28, 2025 May 28, 2025

@m1b Would be great to see if you can reproduce this on your end by trying this on file with multiple artboards, some of them empty.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 28, 2025 May 28, 2025

Hi @urbanstarship I've can reproduce the issue on my system here. Not sure if it is a bug, per se, but it is certainly not helpful behaviour.

 

In this case I would be inclined—rather than lodge a bug report—to put in a check in your code for an empty artboard before exporting. Here is a script that exports every artboard in the document, but only after checking if it's empty or not. The check is a bit of a hack, and destroys the current selection.

- Mark

 

/**
 * @file Export Every Artboard As PSD.js
 * 
 * Example of checking whether an artboard
 * is empty before exporting.
 * 
 * @author m1b
 * @version 2025-05-28
 * @discussion https://community.adobe.com/t5/illustrator-discussions/exportfile-broken-when-upgrading-to-illustrator-2025/m-p/15344164
 */
(function () {

    var doc = app.activeDocument;

    if (!doc.fullName.exists)
        return alert('Please save this document first.');

    for (var i = 0; i < doc.artboards.length; i++)
        exportArtboardAsPSD(doc, i);

})();

function exportArtboardAsPSD(doc, index) {

    if (index < 0 || index > doc.artboards.length)
        throw new Error('exportArtboardAsPSD: bad `index` supplied.');

    // check if there's artwork on this artboard
    doc.selection = [];
    doc.artboards.setActiveArtboardIndex(index);
    app.executeMenuCommand('selectallinartboard');

    if (0 === doc.selection.length)
        // nothing on this artboard
        return;
    else
        doc.selection = [];

    var exportOptions = new ExportOptionsPhotoshop();

    // export artboard 1
    doc.artboards.setActiveArtboardIndex(index);
    exportOptions.artboardRange = index+1;

    exportOptions.antiAliasing = true;
    exportOptions.artBoardClipping = true;
    exportOptions.editableText = true;
    exportOptions.imageColorSpace = ImageColorSpace.CMYK;
    exportOptions.maximumEditability = true;
    exportOptions.resolution = 72;
    exportOptions.saveMultipleArtboards = true;
    exportOptions.warnings = false;
    exportOptions.writeLayers = true;

    var file = File(doc.fullName.parent + '/test_' + doc.artboards[index].name + '.psd');

    doc.exportFile(file, ExportType.PHOTOSHOP, exportOptions);

    // reveal the exported file
    // file.parent.execute();

};

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 29, 2025 May 29, 2025
LATEST

Thank you @m1b , that seems to have worked.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines