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.
1 Correct answer
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;
...
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
Copy link to clipboard
Copied
How about PACKAGE option - but turn off copying fonts and links?
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
Copy link to clipboard
Copied
PDF can be turned off as well.
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
@Mike Bro Thank you so much for this code, ypou saved my life. After the recent update ID files were getting damaged and was not able to open. I lost hours of work like this, so the only solution was to save the IDML along with IDD to save my time. This works perfect.
Copy link to clipboard
Copied

