export every open file to idml
I'm trying to export every open InDesign file to idml in the same folder.
(I'm trying javascript and Visual Studio Code for the first time.)
main();
function main(){
var i;
for (i = 0; i < app.documents.length - 1; i++) {
fileName = app.documents.item(i).filePath + "/" + app.documents.item(i).name.split('.').slice(0, -1).join('.') + "\.idml";
app.documents.item(i).exportFile(ExportFormat.INDESIGN_MARKUP, fileName);
}
}
But, I get the following error.
Runtime Error: Error Code# 48: Folder ""/c/temp/test.idml"" not found.
What do I need to do here?
I also need this to work if the path is to a folder on the Desktop (e.g., ""~/Desktop/temp/test.idml"").
Thanks.