Eu achei o script de @ Arthur muito útil. No entanto, eu queria usá-lo apenas afterSave
, mas também afterSaveAs
(o que foi fácil de estender: basta acrescentar outro comando de ouvinte de evento) e afterSaveACopy
(o que eu não consegui realizar sozinho; procurei a ajuda em community.adobe.com ).
Agora eu tenho um script de trabalho que funciona para todos os três casos de uso, veja abaixo.
// 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);