Skip to main content
Known Participant
November 23, 2025
Answered

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

  • November 23, 2025
  • 2 replies
  • 995 views

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:

 

Correct answer jduncan

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");
})();

 

2 replies

jduncan
Community Expert
Community Expert
November 25, 2025

Check this post https://community.adobe.com/t5/illustrator-discussions/how-to-exclude-artboard-name-when-exporting-jpegs-with-quot-exportforscreens-quot-script-in/m-p/14056282#M378900 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);
}
paloma95Author
Known Participant
November 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.

 

 

jduncan
Community Expert
jduncanCommunity ExpertCorrect answer
Community Expert
November 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");
})();

 

paloma95Author
Known Participant
November 25, 2025

Bumping for visibility.