When a document does not have any modal dialog window messages, app.activeDocument.close(SaveOptions.no)
works fine.
However, I have some InDesign documents that do have such windows appear, showing error messages about links that need to be updated, or incorrect styles. The above statement won't work in this case, as the windows prevent the script from accessing the document.
So, is there a way to iterate through all of the modal-dialogs in the active document? Here is what I have tried so far, which is not working:
if(xmlFile == "")
{
//alert("There is no linked XML file in this document,\n\ttry a different document.");
for(var i = 0; i < app.activeDocument.Windows.length; i++)
{
app.activeDocument.Windows[i].close();
}
app.activeDocument.close(SaveOptions.no);
exit();
}