2 Replies Latest reply on Sep 5, 2013 11:52 AM by easilyused

    Can someone modify this page duplication and relinking script to handle 2 layouts?

    easilyused

      Hello!

       

      After searching for what I need at length, I was able to come up with this post: http://forums.adobe.com/message/5341001

       

      With the following script:

       

      var mDoc = app.activeDocument;

      var stop = 2;

      var mPDF, oldPageNum, currPDF, currFile, mRec;

       

      while (stop > 1) {

          stop = 1;

          var mPage = mDoc.pages[-1].duplicate();

          var mGraphics = mPage.allGraphics;

          for (var i = 0; i < mGraphics.length; i ++) {

              mPDF = mGraphics[i].parent.pdfs[0];

              if (mPDF.isValid && mPDF.itemLink.status == LinkStatus.NORMAL) {

                  oldPageNum = mPDF.pdfAttributes.pageNumber;

                  app.pdfPlacePreferences.pageNumber = oldPageNum + 1;

                  currFile = mPDF.itemLink.filePath;

                  mRec = mPDF.parent;

                  mRec.place(File(currFile) );

                  stop = mRec.pdfs[0].pdfAttributes.pageNumber;

                  }

              }

      }

      mPage.remove();

       

      However, what I really need is this script to function with two page layouts, one for even pages and one for odd pages, because I'd be printing these on a double sided duplexed page, and each layout must be different so that they will align correctly. Seems easy enough, but I'm no good at javascript this complex :/

       

      Can anyone modify this script to do this? thanks!

       

      Windows7 CS6