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

Script that save IDML when saving INDD

Explorer ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Is there a script available that will save an IDML each time I save an INDD file? If yes, does that script save over an exisitng IDML for that file (preferred) or does it create a new IDML file with an altered name each time I resave the INDD file?

 

I saw a thread about a script that will save an INDD, IDML and PDF at the same time, but I don't need all of that.

TOPICS
Scripting

Views

432

Translate

Translate

Report

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

Advisor , Sep 20, 2022 Sep 20, 2022

Hello @Meredith0404,

The below script will do what you're asking for...It's a startup script that goes here:

/Applications/Adobe InDesign 2022/Scripts/startup scripts

#targetengine "session"
/////////////////////////////////////////////////////////////////////////////////////////////////////
function saveIDML() {
    if(app.layoutWindows.length == 0) return;
    else if (!app.activeDocument.saved) {
        alert('Sorry, there was a problem and the document was not saved.');
        return;
       
...

Votes

Translate

Translate
Community Expert ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Point us to the script you found and probably it will be quicker to edit it for your needs?

-Manan

Votes

Translate

Translate

Report

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 ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

How about PACKAGE option - but turn off copying fonts and links? 

Votes

Translate

Translate

Report

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 ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

But that would include the PDF I suppose and @Meredith0404 does not want the pdf and also this would require her to do a few more clicks rather than an automatic script. So probably this won't suit her wishes and @Mike Bro has already graciously put togehter a script from scratch so we are good.

-Manan

Votes

Translate

Translate

Report

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 ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

PDF can be turned off as well. 

Votes

Translate

Translate

Report

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
Advisor ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

Hello @Meredith0404,

The below script will do what you're asking for...It's a startup script that goes here:

/Applications/Adobe InDesign 2022/Scripts/startup scripts

#targetengine "session"
/////////////////////////////////////////////////////////////////////////////////////////////////////
function saveIDML() {
    if(app.layoutWindows.length == 0) return;
    else if (!app.activeDocument.saved) {
        alert('Sorry, there was a problem and the document was not saved.');
        return;
        }
    var idmlPath =  app.activeDocument.filePath.fsName.replace(/\\/g,'/')+'/'+app.activeDocument.name.replace(/\.indd|\.indt/g,'.idml');
    app.activeDocument.exportFile(ExportFormat.INDESIGN_MARKUP, idmlPath, false);
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////
function saveACopyIDML(e) {
    var idmlPath = File(e.properties.fullName).fsName.toString().replace(/\\/g,'/').replace(/\.indd|\.indt/g,'.idml');
    app.activeDocument.exportFile(ExportFormat.INDESIGN_MARKUP, idmlPath, false);
    }
/////////////////////////////////////////////////////////////////////////////////////////////////////
// Listen for the save event
app.addEventListener('afterSave', saveIDML, false);
app.addEventListener('afterSaveAs', saveIDML, false);
app.addEventListener('afterSaveACopy', saveACopyIDML, false);

Regards,

Mike

Votes

Translate

Translate

Report

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 ,
Sep 20, 2022 Sep 20, 2022

Copy link to clipboard

Copied

You're all amazing! Thanks so much for everyones' speedy help. Mike, I'll try out your script today/tomorrow (not a design rush need, for once :), but looks like this is exactly what I need.

Votes

Translate

Translate

Report

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 ,
Oct 05, 2022 Oct 05, 2022

Copy link to clipboard

Copied

LATEST

Just wanted to say thanks again Mike. I finally got breathing space at work to test out this script. It works perfectly! Saves me small but important steps in my daily workflow.

Votes

Translate

Translate

Report

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