Saya telah menemukan script @ Arthur sangat berguna. Namun, saya hanya ingin menggunakannya saja afterSave
, tetapi juga afterSaveAs
(yang mudah diperpanjang: cukup tambahkan perintah pendengar acara lain) dan afterSaveACopy
(yang tidak bisa saya selesaikan sendiri; saya telah mencari bantuan di community.adobe.com ).
Sekarang saya memiliki skrip yang berfungsi untuk ketiga use case, lihat di bawah.
// 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);