: Script to always save IDML with INDD Is there an existing script for InDesign that will save an INDD file and an IDML copy at the same time? I work with dozens of independent designers on
Is there an existing script for InDesign that will save an INDD file and an IDML copy at the same time?
I work with dozens of independent designers on collaborative projects, and those of us with Creative Cloud have to remember to save an IDML copy for those on earlier versions. And we often forget.
I'm hoping to find or tweak a script that will, for instance, add a menu item called, say, 'Save with IDML', and will save both the current document and an IDML copy alongside it.
More posts by @Michele215
2 Comments
Sorted by latest first Latest Oldest Best
Thanks, @fabiantheblind , that works brilliantly. I've added a few (borrowed) lines to make it work as a Startup Script (so it waits for a document to be opened).
#targetengine "session"
// we need a targetengine to make this work
app.addEventListener('afterOpen', function(myEvent) {
// Only run once a document is opened. See forums.adobe.com/message/5410190 if(app.layoutWindows.length == 0) return; // Just return when no windows shown avoiding first run...
var doc = app.activeDocument; // get the current doc
// now to the event listener
app.addEventListener('afterSave', function(theEvent) {
$.writeln('saving'); // just to see whats going on
if (!doc.saved) {
// catch those possible mistakes
alert('doc was never saved');
exit();
}
var aName = doc.name; // get the name
var newName = aName.replace("indd", "idml"); // replace the indd to idml
// crate a new File Object next to the indd
var theFile = File(File(doc.filePath).fsName + "/" + newName);
// export
doc.exportFile(ExportFormat.INDESIGN_MARKUP, theFile, false);
});
});
This example should get you started. You need to run the script once per InDesign session. You could add it as a startup script for example. It will save everytime the user saves the document a idml file.
#targetengine "session"
// we need a targetegine to make this work
var doc = app.activeDocument; // get the current doc
// now to the event listener
app.addEventListener('afterSave', function(theEvent) {
$.writeln('saving'); // just to see whats going on
if (!doc.saved) {
// catch those possible mistakes
alert('doc was never saved');
exit();
}
var aName = doc.name; // get the name
var newName = aName.replace("indd", "idml"); // replace the indd to idml
// crate a new File Object next to the indd
var theFile = File(File(doc.filePath).fsName + "/" + newName);
// export
doc.exportFile(ExportFormat.INDESIGN_MARKUP, theFile, false);
});
If you want this as a menu command you could take look into this blog post on indiscripts.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.