2 Replies Latest reply on Jun 28, 2010 2:52 PM by Saman

    “Save as Master” in JavaScript - Help!

    Saman Level 1

      Hello Guys,

      I have an inDesign file with 3 pages. I want to create new 3 “Master Spreads” like (B-Master, C-Master, D-Master) with the same content in those 3 pages, like “Save As Master” function inDeisgn UI. Is there any way this can be done with the scripting?

      I’m not trying to apply another master spread to the new master spread page, or add master spread to a new page, but create a new master using existing page.

      Any hint, a direction, immensely appreciated.

        • 1. Re: “Save as Master” in JavaScript - Help!
          [Jongware] Most Valuable Participant

          That took some lateral thinking -- and three InDesign crashes!

           

          The canonical method to use is "duplicate", but apparently, you cannot simply 'duplicate' a page onto the end of your current master spreads (that caused my ID to crash, silently). With this work-around, it works:

           

          1. add a new master spread and force it to be just 1 page, because it seems the default is an entire spread.

          2. tag on your page at the end of its 'Pages' property.

          3. remove the single page at the start of your master page, since you don't need it anymore.

           

          This works for me in CS4:

           

          p = app.activeWindow.activePage;
          m = app.activeDocument.masterSpreads.add(1);
          p.duplicate (LocationOptions.AT_END,m.pages[0]);
          m.pages[0].remove();
          

          • 2. Re: “Save as Master” in JavaScript - Help!
            Saman Level 1

            I totally like it! Unorthodox! Interesting and brilliant! Thank you very much!

            Got it to working in CS3 with this.

            myDoc = app.documents[0];
            m = app.activeDocument.masterSpreads.add(1);
            myDoc.pages[-1].duplicate (LocationOptions.AT_END,m.pages[0]);
            m.pages[0].remove();

             

            Thanks Again!