Skip to content
Fabian Morón Zirfas edited this page Mar 4, 2020 · 5 revisions

Export the current document to the desktop.

var theFolder= "~/Desktop";
// needs a active document
var doc = app.activeDocument;
var aName = doc.name;
var newName = aName.replace("indd","idml");
var theFile = File(theFolder +"/"+ newName );
doc.exportFile(ExportFormat.INDESIGN_MARKUP, theFile, false);

Save it right next to current active document.

// export the InDesign document to .idml
// tested on Mac OSX
// this code is Public Domain
//
// check if the doc is saved
var doc = app.activeDocument;
if (!doc.saved) {
  doc.save();// if not save it
}
// take the .indd's name and make a .idml from it
var aName = doc.name;// get the name
var newName = aName.replace("indd", "idml");// replace the indd to idml
// crate a new File Object
var theFile = File(File(doc.filePath).fsName + "/" + newName);
// export
doc.exportFile(ExportFormat.INDESIGN_MARKUP, theFile, false);
// done
Clone this wiki locally