Skip to main content
Inspiring
January 8, 2025
Answered

Indesign export JPEG script with control of suffix

  • January 8, 2025
  • 2 replies
  • 384 views

How can I write a JavaScript script for InDesign to export JPEGs while ensuring that any leftover text in the "Suffix" field from previous exports (e.g., "_^P" left after exporting pages) is cleared or replaced?

 

Currently, when I use an export script, it adds "_01" to every image due to this leftover input.

 

Is there a way to access and modify the value in the "Suffix" field through the script?

 

Any help will be appreciated.

 

Correct answer Peter Kahrel

Use an object-model viewer, e.g. https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html

 

There you'll find the jpegExportPreferences property, which in turn has the jpegSuffix property. To nuke an existing string, do this:

 

app.jpegExportPreferences.jpegSuffix = '';

2 replies

Peter Kahrel
Community Expert
Community Expert
January 8, 2025

The page you saw is for UXP, the one I sent you is for ExtendScript. Strange though that jpegSuffix is missing on that page. It seems unlikely that UXP doesn't have that property.

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
January 8, 2025

Use an object-model viewer, e.g. https://www.indesignjs.de/extendscriptAPI/indesign-latest/#about.html

 

There you'll find the jpegExportPreferences property, which in turn has the jpegSuffix property. To nuke an existing string, do this:

 

app.jpegExportPreferences.jpegSuffix = '';
Inspiring
January 8, 2025

Brilliant, this worked. Thanks for the link also, my searching lead me to here https://developer.adobe.com/indesign/dom/api/j/JPEGExportPreference/  where it did'nt have this.