2 Replies Latest reply on Oct 10, 2016 4:27 AM by lucas.maximus

    Copy from Doc1 and paste in Doc2 - in center of page


      Hello to everyone on the forums,


      I am using the code below to open 'doc1' and paste its contents into 'doc2'


      Could anyone please help me to ensure doc1 is pasted into the center of doc2?

      doc2 is larger, and the objects currently paste off center, flush to the left hand side and centrally on the y-axis


      If there is a way to paste directly to center? or if not, move everything to the center after pasting?


      Thank you!




      // open the BMDFile external doc

      var BMDFile = "myfilepath"



      var doc1 = app.documents[0]; //  the BMDFile external doc

      var doc2 = app.documents[1];  // currently open blank doc


      for(i=0; i<doc1.pages.length; i++)


          if(doc2.pages.length < i+1){




      // group everything to avoid the order changing

          var myObj = new Array;

          myObj = app.activeWindow.activePage.pageItems;



      // duplicate



      // ungroup everything

          with(app.documents[1]) { 

              while (groups.length != 0) { 







      // close the BMDFile external doc, dont save changes