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

Export For Screens keeps adding artboard name in the file suffix. How to remove? Possible script?

Community Beginner ,
Nov 23, 2025 Nov 23, 2025

I keep the suffix box blank yet when I export a JPG with Export for Screens, Illustrator always adds the name of the artboard at the end of the file name. Everything is perfect besides this. I need to this to stop.

If there's no way to do this natively, is there a script that can do this? I establish the file name and file location already when I initially save as ai. It's just the jpg part that I'm trying to iron out. Thanks in advance!

These are my settings:

Screenshot 2025-11-23 at 12.09.41 PM.png

paloma95_1-1763921613255.png

 

TOPICS
Bug , How-to , Scripting
862
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 , Nov 25, 2025 Nov 25, 2025

Sorry, I should have been more clear. The post I linked (and accompanying script I pasted) was just to show the concept of exporting your files and then renaming them via a script which is the only way I have found to control the names of the exported files. Basically as long as you know the name and location of the exported files you can rename it after the export (removing the artboard name).

 

There is more than one way to export a JPEG via scripting but since you are already using Export for

...
Translate
Adobe
Community Beginner ,
Nov 25, 2025 Nov 25, 2025

Bumping for visibility.

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 ,
Nov 25, 2025 Nov 25, 2025

Check this post https://community.adobe.com/t5/illustrator-discussions/how-to-exclude-artboard-name-when-exporting-j... to see if it works for you.

 

"I recently ran across this same issue and couldn't determine a way to set the name correctly before saving/exporting so I instead just rename the files after the save/export. The code below will export the artboard(s) you specify in the `artboardsToExport` array (0-index), then rename the exported file(s) to just "Artboad X.ai". The `baseName` variable is just so I know how to exactly recreate the path for renaming."

 

doc = app.activeDocument;
exportFiles("TEST");

function exportFiles(baseName) {
  var expOptions = new IllustratorSaveOptions();
  expOptions.flattenOutput = OutputFlattening.PRESERVEAPPEARANCE;
  expOptions.saveMultipleArtboards = true;

  var artboardsToExport = [1, 2];
  var ab, tempFile, finalFile, testFile;
  for (var i = 0; i < artboardsToExport.length; i++) {
    ab = doc.artboards[artboardsToExport[i]];

    // When exporting specific artboards, the api only allows specifying the first part of
    // the file name, then it appends `_Artboard Name` and add the extension which result in:
    //`{baseName}_Artboard X.{extension}`
    tempFile = new File(doc.path + "/" + baseName);

    // To be able to correctly name the exported file(s), I am recreating the known
    // naming convention with a new `file` object to that path
    finalFile = new File(doc.path + "/" + baseName + "_" + ab.name + ".ai");

    // Since the export exported file path and the preferred file path are different the built-in
    // file overwrite protection will not prompt you so and the `rename` method would not
    // overwrite the existing file. So, here I do the checking and prompt if needed.
    testFile = new File(doc.path + "/" + ab.name + ".ai");
    if (testFile.exists) {
      if (
        !Window.confirm(
          "File already exists!\nOverwrite " + ab.name + ".ai?",
          "noAsDflt",
          "File Already Exists"
        )
      ) {
        // If you choose not to overwrite I just remove the exported artboard
        finalFile.remove();
        continue;
      } else {
        // Otherwise, I remove the file at that path so the rename works
        testFile.remove();
      }
    }

    // Export the file
    expOptions.artboardRange = artboardsToExport[i] + 1 + "";
    doc.saveAs(tempFile, expOptions);

    // Rename the file
    finalFile.rename(ab.name + ".ai");
  }

  doc.close(SaveOptions.DONOTSAVECHANGES);
}
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 Beginner ,
Nov 25, 2025 Nov 25, 2025

Thank you but it's not exactly what I'm looking for. I don't want it to rename the file to Artboad X.ai. In the Export For Screens panel, it already has the correct file name (and folder to save in) from when I initially save as an ai file and I don't want to change that.
I did try running the script though and got an error, but I'm not sure what to change. FYI I'm only exporting one artboard each time.

paloma95_0-1764100824414.png

 

 

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 ,
Nov 25, 2025 Nov 25, 2025

Sorry, I should have been more clear. The post I linked (and accompanying script I pasted) was just to show the concept of exporting your files and then renaming them via a script which is the only way I have found to control the names of the exported files. Basically as long as you know the name and location of the exported files you can rename it after the export (removing the artboard name).

 

There is more than one way to export a JPEG via scripting but since you are already using Export for Screens here's a script tailored for your needs. Take it for a spin and let me know if it works for you? Cheers!

 

(function () {
    //@target illustrator

    // no need to continue if there is no active document
    if (!app.documents.length) {
        alert("No active document.");
        return;
    }

    // get the current document and it's path (if saved)
    var doc = app.activeDocument;
    var docFolder = new Folder(doc.path == "" ? "~/" : doc.path);

    // strip off any extensions from the document name
    var exportName = doc.name.replace(/\.pdf|\.ai|\.eps$/i, "");

    // disable creating folders when exporting (same as setting in GUI)
    // thanks to Carlos Canto https://community.adobe.com/t5/user/viewprofilepage/user-id/9300165
    app.preferences.setIntegerPreference(
        "plugin/SmartExportUI/CreateFoldersPreference",
        0
    );

    var whatToExport = new ExportForScreensItemToExport();
    whatToExport.artboards = "1";
    whatToExport.document = false;

    var jpgOptions = new ExportForScreensOptionsJPEG();
    jpgOptions.compressionMethod = JPEGCompressionMethodType.BASELINEOPTIMIZED;
    jpgOptions.antiAliasing = AntiAliasingMethod.TYPEOPTIMIZED;
    jpgOptions.scaleType = ExportForScreensScaleType.SCALEBYRESOLUTION;
    jpgOptions.scaleTypeValue = 300;

    activeDocument.exportForScreens(
        docFolder,
        ExportForScreensType.SE_JPEG100,
        jpgOptions,
        whatToExport,
        exportName
    );

    // When exporting artboards using the exportForScreens method, the api adds
    // "Artboard" to the actual artboard name resulting in `{prefix}Artboard X.{extension}`
    // To be able to correctly name the exported file, I am recreating the known
    // naming convention with a new `file` object to that path and then just renaming the file.
    var exportedFile = new File(
        doc.path + "/" + exportName + doc.artboards[0].name + ".jpg"
    );
    exportedFile.rename(exportName + ".jpg");
})();

 

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 Beginner ,
Nov 25, 2025 Nov 25, 2025

Holy smokes, this works flawlessly!! Thank you SO much!

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 Beginner ,
Nov 25, 2025 Nov 25, 2025

I have one more question, is there a way to ensure it exports as RGB?

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 ,
Nov 25, 2025 Nov 25, 2025

The documentation for `ExportForScreensOptionsJPEG` is limited so I'm not aware of anyway to specify the exported file color mode as RGB. I think you'll have to use the `exportFile` method instead. I'm not at my computer right now but can work up a script later and share it once I get back to my laptop.

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 Beginner ,
Nov 25, 2025 Nov 25, 2025

I would really appreciate that, thank you so much!

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 ,
Nov 26, 2025 Nov 26, 2025

Okay, so there is no "good" answer but you do have two options that will get you the results you are wanting...

 

Option #1 - Using the `exportForScreens` method.

This is the option we used above but it has one caveat. When you are working with a CMYK file the exported JPEG will also be in CMYK. Weirdly enough, when you use the gui version via File > Export > Export For Screens..., you can specify an output color model (see image below ).

 

CleanShot 2025-11-26 at 12.11.01@2x Medium.jpeg

 

But unfortunately, you can't set this via scripting. So the script below checks to see of the document is CMYK and if it is, it will alert you to manually change the document color space via `File > Document Color Mode > RGB Color` and rerun the script. As you can see in the script comments, I tried executing that menu command via the script so you don't have to do it manually but for some reason Ai loses reference to the current document which causes the actual export to break.

 

Besides the color model issue, this method works great because you get a true 300 ppi final JPEG file named the way you want it.

 

// Option #1 - exportForScreens method

(function () {
    //@target illustrator

    // no need to continue if there is no active document
    if (!app.documents.length) {
        alert("No active document.");
        return;
    }

    // get the current document and it's path (if saved)
    var doc = app.activeDocument;
    var docFolder = doc.path == "" ? Folder.desktop : new Folder(doc.path);

    // strip off any extensions from the document name
    var exportName = doc.name.replace(/\.pdf|\.ai|\.eps$/i, "");

    // The GUI version of Export For Screens allows the user to choose the export color space
    // but that option isn't available in ExtendScript so CMYK documents result in CMYK JPEGs.
    // To force the exported JPEGs as RGB we'll temporarily change the document color space
    // and then undo the change after export. Unfortunately this doesn't work as expected.
    // After executing the `doc-color-rgb` menu command, the ExtendScript engine loses
    // reference to any open Ai documents.
    if (doc.documentColorSpace == DocumentColorSpace.CMYK) {
        // app.executeMenuCommand("doc-color-rgb"); // this breaks the script
        alert(
            "Color Space Error!\nYour current document has a color space of CMYK. Please change the color space via File > Document Color Mode > RGB color and rerun the script."
        );
        return;
    }

    // disable creating folders when exporting (same as setting in GUI)
    // thanks to Carlos Canto https://community.adobe.com/t5/user/viewprofilepage/user-id/9300165
    app.preferences.setIntegerPreference(
        "plugin/SmartExportUI/CreateFoldersPreference",
        0
    );

    // set export for screens options
    var whatToExport = new ExportForScreensItemToExport();
    whatToExport.artboards = "1";
    whatToExport.document = false;

    // set jpeg export options
    var opts = new ExportForScreensOptionsJPEG();
    opts.embedICCProfile = true;
    opts.compressionMethod = JPEGCompressionMethodType.BASELINEOPTIMIZED;
    opts.antiAliasing = AntiAliasingMethod.TYPEOPTIMIZED;
    opts.scaleType = ExportForScreensScaleType.SCALEBYRESOLUTION;
    opts.scaleTypeValue = 300;

    doc.exportForScreens(
        docFolder,
        ExportForScreensType.SE_JPEG100,
        opts,
        whatToExport,
        exportName
    );

    // When exporting artboards using the exportForScreens method, the api adds
    // "Artboard" to the actual artboard name resulting in `{prefix}Artboard X.{extension}`
    // To be able to correctly name the exported file, I am recreating the known
    // naming convention with a new `file` object to that path and then just renaming the file.
    var exportedFile = new File(
        doc.path + "/" + exportName + doc.artboards[0].name + ".jpg"
    );
    exportedFile.rename(exportName + ".jpg");
})();

 

Option #2 - Using the `exportFile` method.

This alternate options works great because you can specify and exact name for the exported JPEG and don't have to worry about renaming any files but it doesn't allow you to export 300 ppi (kind-of) and the exported file is always RGB no matter the color space of the Ai file.

 

So what's the downside... Well, to get a 300 ppi file, the script has to scale the artwork up. Now, there is nothing inherently wrong with this but the exported file is not encoded with a resolution (not available via scripting) so the even though the resulting file is the exact same pixel dimensions as the `exportForScreens` method version (see comparison pics below), if you were to open it in Photoshop, it would open at 72 ppi. Since, I'm not sure of your final use for the exported JPEGs, I don't know if this is an issue or not.

 

CleanShot 2025-11-26 at 12.20.37.png

image.png

 

// Option #2 - exportFile method

(function () {
    //@target illustrator

    // no need to continue if there is no active document
    if (!app.documents.length) {
        alert("No active document.");
        return;
    }

    // get the current document and it's path (if saved)
    var doc = app.activeDocument;
    var docFolder = doc.path == "" ? Folder.desktop : new Folder(doc.path);

    // strip off any extensions from the document name
    var exportName = doc.name.replace(/\.pdf|\.ai|\.eps$/i, "");

    // calculate scale factor for 300 ppi (sized) image
    var scaleFactor = 300 / 72;

    // set jpeg export options https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG/
    var opts = new ExportOptionsJPEG();
    opts.antiAliasing = true;
    opts.artBoardClipping = true;
    opts.horizontalScale = scaleFactor * 100; // Ai wants a percent value (100 = 1×)
    opts.verticalScale = scaleFactor * 100; // Ai wants a percent value (100 = 1×)
    opts.optimization = false; //
    opts.qualitySetting = 100;

    // set export type
    var type = ExportType.JPEG;

    // set export file
    var exportFile = new File(docFolder + "/" + exportName + ".jpg");

    // export JPEG https://ai-scripting.docsforadobe.dev/jsobjref/Document/?h=exportfile#documentexportfile
    doc.exportFile(exportFile, type, opts);
})();

 

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 Beginner ,
Nov 26, 2025 Nov 26, 2025

First of all, thank you so much for taking the time to put this together! The walkthrough is super insightful. The 2nd option is super close, the only thing I'm noticing with it is that the file name ads dashes where spaces should be.

Regarding your first option, for a little context, I use templates for work in which some are set to CMYK. If I change the document color mode to RGB, the colors of the template change drastically. If I keep the document color mode to CYMK but export as RGB, the colors stay as they should be (and how I see them on my canvas). It doesn't make sense to me! Anything you might know about that might enlighten me.

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 ,
Nov 26, 2025 Nov 26, 2025

Yeah, the color conversion in Ai isn't great and I don't really know a good workaround for that. If the only issue with option #2 is the hypens in the name (added by Ai not me), we can easily fix that with the same file renaming trick we used in option #1. I'm away from my laptop at the moment so I'll post an updated version later when I get back.

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 Beginner ,
Nov 26, 2025 Nov 26, 2025

Yeah in that case it looks like option 2 is the way to go! Sounds good!

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 ,
Nov 26, 2025 Nov 26, 2025

Ok, here's a revised version. Basically, I go ahead and replace all spaces in the file name with hypens before exporting, then remove them after export. One thing to note, different parts of the Illustrator API seem to use different methods for exporting files so I would check the resulting JPEGs to ensure all of the colors are as you would expect. Take it for a spin and let me know if you have any issues? Cheers!

 

(function () {
    //@target illustrator

    // No need to continue if there is no active document.
    if (!app.documents.length) {
        alert("No active document.");
        return;
    }

    // Get the current document and it's path (if saved).
    var doc = app.activeDocument;
    var docFolder = doc.path == "" ? Folder.desktop : new Folder(doc.path);

    // Strip off any extensions from the document name and change the spaces to hyphens.
    var exportName = doc.name.replace(/\.pdf|\.ai|\.eps$/i, "") + ".jpg";
    var exportNameHyphenated = exportName.replace(/ +/g, "-");

    // Set export files.
    var exportFile = new File(docFolder + "/" + exportName);
    var exportFileHyphenated = new File(docFolder + "/" + exportNameHyphenated);

    // Since we are "hacking" the naming of the exported file, there is a situation when
    // you have already exported the file, then rerun the script and it will not remove
    // the hyphens from the name. This block, first checks to see if the "about to be" exported
    // file already exists on the system and if so, will get confirmation from the user
    // to overwrite the existing file before continuing.
    if (exportFile.exists) {
        if (
            Window.confirm(
                "File already exists!\nOverwrite " + decodeURI(exportFile.name) + "?",
                "noAsDflt",
                "File Already Exists"
            )
        ) {
            exportFile.remove();
        } else {
            return;
        }
    }

    // Calculate scale factor for 300 ppi (sized) image.
    var scaleFactor = 300 / 72;

    // Set jpeg export options. docs:https://ai-scripting.docsforadobe.dev/jsobjref/ExportOptionsJPEG/
    var opts = new ExportOptionsJPEG();
    opts.antiAliasing = true;
    opts.artBoardClipping = true;
    opts.horizontalScale = scaleFactor * 100; // Ai wants a percent value (100 = 1×)
    opts.verticalScale = scaleFactor * 100; // Ai wants a percent value (100 = 1×)
    opts.optimization = false; //
    opts.qualitySetting = 100;

    // Set export type.
    var type = ExportType.JPEG;

    // Export JPEG file. docs:https://ai-scripting.docsforadobe.dev/jsobjref/Document/?h=exportfile#documentexportfile
    doc.exportFile(exportFileHyphenated, type, opts);

    // Rename the file to match the Ai file by removing the inserted hyphens.
    exportFileHyphenated.rename(exportName);
})();

 

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 Beginner ,
Nov 26, 2025 Nov 26, 2025

This works perfectly!! Many thanks again!

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 ,
Nov 26, 2025 Nov 26, 2025
LATEST

My pleasure!

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