10 Replies Latest reply on Sep 6, 2011 6:51 AM by csm_phil

    Waiting for autoflow to finish.

    Vintage-uk Adobe Employee

      Hi,

       

      I have a simple script that places an ICML file into a textframe and then saves the document.

       

      The target document is set to autoflow the ICML content, and it creates new pages as needed. This works fine.

       

      However the save operation does not wait for the autoflow to complete. So the saved document only has one page with overset text.

      It should have 2 pages and no overset text.

      If I leave the page open in InDesign, after a very short delay, a new page is added and the text is autoflowed.

       

      How can I get InDesign to wait for the autoflow operation to finish before saving the file?

       

      Script:

       

              var myDocument = app.activeDocument;
              var myPage = myDocument.pages.item(0);
              var myTextFrame = myPage.textFrames.itemByName("mainBody");   
              myTextFrame.place(File("page1.icml"));
              myDocument.save(File("document1.indd"));

       

      Thanks.