6 Replies Latest reply on Feb 16, 2017 1:23 AM by jjrger

    Simple script, but cannot handle the request(dialog or alert is active

    jjrger

      Hello,

       

      I try this simple script.

      Extendscript returns error "cannot handle the request because a modal dialog or alert is active".

      "w.close()" seems not working.

       

      Don't understand why, can somebody explain me please?

       

      #target "InDesign" 
      #targetengine "main"
      
      win();
      
      function win() { 
          
          var w = new Window ("palette", "UI"); 
          var myBtn = w.add ("button", undefined, "nouveau document"); 
          myBtn.onClick = function() {
              w.close(); 
              newDoc();
          }
          w.show ();   
      }
      
      function newDoc (){
          
          var doc = app.documents.add(true);
          with(doc.documentPreferences){
              pageHeight = "2000mm";
              pageWidth = "2000mm";
              pageOrientation = PageOrientation.landscape;
              pagesPerDocument = 1;
          }
      }