¿Existe una secuencia de comandos existente para InDesign que guarde un archivo INDD y una copia IDML al mismo tiempo?
Trabajo con docenas de diseñadores independientes en proyectos colaborativos, y aquellos de nosotros con Creative Cloud debemos recordar guardar una copia IDML para aquellos en versiones anteriores. Y muchas veces nos olvidamos.
Espero encontrar o modificar un script que, por ejemplo, agregue un elemento de menú llamado, digamos, 'Guardar con IDML', y guarde tanto el documento actual como una copia de IDML junto a él.
Este ejemplo debería ayudarlo a comenzar. Debe ejecutar el script una vez por sesión de InDesign. Puede agregarlo como un script de inicio, por ejemplo. Se guardará cada vez que el usuario guarde el documento en un archivo idml.
#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);
});
Si desea esto como un comando de menú, puede consultar esta publicación de blog sobre indiscripts .
Gracias, @fabiantheblind, eso funciona de manera brillante. Lo he adaptado para que funcione como un script de inicio (espera a que se abra un documento).
// Set a targetengine to make this work
#targetengine "session"
function saveIDML() {
// Exit if no documents are open.
if(app.layoutWindows.length == 0) {
return;
} else {
// Get the current document
var doc = app.activeDocument;
$.writeln('Saving IDML of ' + doc + ' ...');
// Catch errors
if (!doc.saved) {
alert('Sorry, there was a problem and the document was not saved.');
exit();
}
// Create a new .idml file name from the .indd file name
var inddName = doc.name;
var idmlName = inddName.replace("indd", "idml");
// Create the new .idml file next to the .indd file
var theFile = File(File(doc.filePath).fsName + "/" + idmlName);
doc.exportFile(ExportFormat.INDESIGN_MARKUP, theFile, false);
}
}
// Listen for the save event
app.addEventListener('afterSave', saveIDML, false);
He encontrado el script de @Arthur muy útil. Sin embargo, quería usarlo solo afterSave
, pero también afterSaveAs
(que era fácil de extender: simplemente agregue otro comando de escucha de eventos) y afterSaveACopy
(que no pude lograr por mí mismo; busqué ayuda en community.adobe.com ).
Ahora tengo un script de trabajo que funciona para los tres casos de uso, vea a continuación.
// 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);
Varonil