0 Replies Latest reply on Dec 9, 2015 11:35 AM by Lugiber28

    Progress "window" after a "dialog" doesn't show.

    Lugiber28

      I have written a script for indesign where you first get a dialog window with a couple of options, and after you close that window you're supposed to see a small window with progress information.

      But Indesign stops with the ui updates after the dialog window. If I disable the dialog window my progress window shows up just fine.

       

      I'm on osx 10.11.1 and InDesign CC2015.

       

      Does anyone know what I might do wrong?

      Any help would be very appreciated!

       

      Here's an example of my code that should work as a demo of my problems:

       

      app.scriptPreferences.enableRedraw = true;

      totalLinks = 10;

       

      function showDialog(){

               var win = new Window('dialog', 'Settings');

               var myWin;

              //Add the Go button

              with(win){

                  win.Btns = add('panel', undefined, '');

                  win.Btns.orientation = 'row';

                  win.Btns.align = "right";

                  with(win.Btns){

                      win.GoBtn = add('button', undefined, 'Go!');

                  }

              };

              win.GoBtn.onClick = function(){

                  returncode=1;

                  win.close();

              }

              win.center();

              win.alignChildren = "left";

              myWin = win.show();

      }

      // End dialog window

       

      function statusWindow(windowText,n){

          var myProgressPanel = new Window("window", "Rescaling images");

                        with (myProgressPanel){

                              myProgressPanel.statustext = add("statictext", undefined, 'Processing file: '+(n+1)+' of 10');

                              myProgressPanel.progressBar = add('progressbar', [12, 12, 200, 24], 0, totalLinks);

                  }

                  return myProgressPanel;

      }

      // End progress window

       

      function main(){

      showDialog();

       

      statusWindow('Initwindow...',0);

      myProgressPanel=statusWindow("Preparing Images...",0);

      myProgressPanel.show();

       

      var myProgressPanel;

       

      for (i = 0; i < totalLinks; i++) {

          myProgressPanel.statustext.text = "Image: "+i+' of '+totalLinks;

          myProgressPanel.progressBar.value = i;

          $.sleep(500)

      }

      myProgressPanel.close();

      }

      main();