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