title: InDesign CS5 Script: How can I close all modal dialog windows in a document?
body: <p><br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;When a document does <em>not</em> have any modal dialog window messages, &nbsp;<code>app.activeDocument.close(SaveOptions.no)</code>&nbsp; works fine.
  <br /><br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;However, I have some InDesign documents that <em>do</em> 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.
  <br /><br /><hr />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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 <em>not</em> working:
  <br /></p>
  
  <pre><code>if(xmlFile == "")
  {
      //alert("There is no linked XML file in this document,\n\ttry a different document.");
  
      for(var i = 0; i &lt; app.activeDocument.Windows.length; i++)
      {
          app.activeDocument.Windows[i].close();
      }
  
      app.activeDocument.close(SaveOptions.no);
      exit();
  }
  </code></pre>