I'm relatively new at using scripts & the ExtendScript toolkit - and I'm working in an office environment where I'm using Adobe CC2017 and coworkers are using CS5.
In order for my InDesign files to be usable by all in my department, my understanding is that I need to save my files as IDML files. Ideally, I'd love a script or option that could always enable me to either save files as .idml (as a default) or as both .indd and .idml.
The script that I was using was the one provided in the answer below. (Note that this wasn't an ideal solution, since it only triggered when I chose "Save As" and not "Save". An ideal solution would be an option to save as .idml by default.)
Script to always save IDML with INDD
#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);
});
However, after my CC2017 update, I get the following error message when trying to run the script:
Cannot execute script in target engine 'session'! (#57) Engine 'session' does not exists!
Has anyone else experienced this same issue and if so, do you have any advice how to restore the script (or suggest a better solution for saving to .idml by default) ?