He encontrado el guión de @ Arthur muy útil. Sin embargo, quería usarlo solo afterSave
, pero también afterSaveAs
(que fue fácil de extender: solo agregue otro comando de escucha de eventos) y afterSaveACopy
(que no pude lograr por mí mismo; he buscado la ayuda en community.adobe.com ).
Ahora tengo un script de trabajo que funciona para los tres casos de uso, ver más abajo.
// src: https://community.adobe.com/t5/indesign/get-the-name-of-the-document-created-by-save-a-copy/m-p/10997427#M179868 (based on https://graphicdesign.stackexchange.com/a/71770, which is based on https://graphicdesign.stackexchange.com/a/71736)
// author: Fabian Morón Zirfas (fabianmoronzirfas@graphicdesign.stackexchange.com), modified by Arthur (Arthur@graphicdesign.stackexchange.com), modified by Sunil_Yadav1 (Sunil_Yadav1@community.adobe.com)
// date: 24 March 2020
// Set a targetengine to make this work
#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);