0 Replies Latest reply on Oct 17, 2012 7:22 AM by MarkusVeith

    CS Extension: creating Popup with PopupManager does not work as expected (delayed)

    MarkusVeith Level 1



      i have some issues with a popup opening too late.


      In the following codeflow i have the issues that a popup is not showing up / opening when i call PopUpManager.createPopUp. There are also some InDesign actions started after calling createPopUp. The Popup seems to wait for the InDesign actions and only then is opening.

                                    model.m.win = PopUpManager.createPopUp(model.m, pm.layout.Dialog, true) as pm.layout.Dialog;
      // popup should be opened here
      ...further code...
      ...further code...
      // but popup opens here
      ...further code...


      model.m.win is of type TitleWindow

      and pm.layout.Dialog is a derivation of TitleWindow


      What am i doing wrong? Can i prevent indesign from blocking the extension until it finishes the actions?

      I already tried the methods

      invalidateDisplayList and


      Unfortunately they did not seem to have any effect. Same behaviour with and without those methods.


      Hope the explanation of my problem is understandable.

      Any help would be appreciated. Thanks in advance.



           Markus Veith



      Meanwhile i have written some test code that exactly shows what is not working correctly. What i wanted to achieve is a popup that shows the progress of the different steps i am doing to the document.

      For this it would be important to update the progress bar on every step. Unfortunately the popup is first shown at step 2/4 and then updated at step 4/4. So i do not see the progress on every step.

      // take active Document
                                                        doc = app.activeDocument;
                                                        model.m.win = PopUpManager.createPopUp(model.m, pm.layout.Dialog, true) as pm.layout.Dialog;
      // here popup should have been opened, but it is not shown until step 2/4
                                                        model.m.win.message.text = "";
                                                        var pb:ProgressBar = new ProgressBar();
                                                        pb.label = "Package (%1/%2 bytes) (%3%%)";
                                                        var tmpDir:File = File.createTempDirectory();
                                                        var document_data_file:File = tmpDir.resolvePath(doc.name + ".dat");
                                                        var pdffile:File = tmpDir.resolvePath(doc.name + ".pdf");
                                                        var packagefile:File = tmpDir.resolvePath(doc.name);
                                                        var zipfile:File = tmpDir.resolvePath(doc.name + '.zip');
      // here popup is first time shown with progress 2/4
                                                        var copyingFonts:Boolean = false;
                                                        var copyingLinkedGraphics:Boolean = true;
                                                        var copyingProfiles:Boolean = true;
                                                        var updatingGraphics:Boolean = true;
                                                        var includingHiddenLayers:Boolean = true;
                                                        var ignorePreflightErrors:Boolean = true;
                                                        var creatingReport:Boolean = true;
                                                        var versionComments:String = "comment";
                                                        var forceSave:Boolean = true;
      // here progress bar should have been updated but it is not. It waits till step 4/4
                                                        var pmz:PMZip = new PMZip();
                                                        pmz.zipdir = packagefile;
                                                        pmz.zipfile = zipfile;
      // here the progressbar is updated with 4/4


      My suspicion is that the 2 indesign actions doc.exportFile and doc.packageForPrint block the extension and updates only happen after those indesign actions are finished.


      Message was edited by: MarkusVeith