2 Replies Latest reply on Nov 10, 2016 5:18 AM by Dezignhd

    Indesign Script for multiple pages

    william1375

      Hello,

      I am working on a file that utilizes a data merge to retrieve data from a csv file. This works perfect. This data is text and color I would like to update other fields in the file. The problem I have is that it only works on the first page. How do i script this file to perform the action on each page and take the page specific info and make the updates on that page. Below is the code.

       

      main();

      function main()

      {

      var myStyleOut, mySizeOut,  myTicketOut,  myLT_SloganOut,  myRT_SloganOut,  myLT_SloganColOut,  myRT_SloganColOut,  myLT_TongColOut,  myRT_TongColOut;

      var myText ;

       

      myStyleOut=myTextContent("txtStyle");

      mySizeOut=myTextContent("txtSize");

      myTicketOut=myTextContent("txtStyle");

      myLT_SloganOut=myTextContent("txtLeft_Slogan");

      myRT_SloganOut=myTextContent("txtRight_Slogan");

      myLT_SloganColOut=myTextContent("txtLeft_Slogan_Col");

      myRT_SloganColOut=myTextContent("txtRight_Slogan_Col");

      myLT_TongColOut=myTextContent("txtLeft_Tong_Col");

      myRT_TongColOut=myTextContent("txtRight_Tong_Col");

       

       

      $.write(myStyleOut.contents +"\u000D");

      $.write(mySizeOut.contents +"\u000D"); 

      $.write(myTicketOut.contents +"\u000D");

      $.write(myLT_SloganOut.contents +"\u000D");

      $.write(myRT_SloganOut.contents +"\u000D");

      $.write(myLT_SloganColOut.contents +"\u000D");

      $.write(myRT_SloganColOut.contents +"\u000D");

      $.write(myLT_TongColOut.contents +"\u000D");

      $.write(myRT_TongColOut.contents +"\u000D");

       

       

      //Left Tongue Slogan  

      myObj = app.activeWindow.activeSpread.pageItems.itemByName("frmLeft_Tongue");

      myObj.fillColor=myLT_TongColOut.contents;

      myTextFrame = app.activeDocument.textFrames.itemByName("txtLeftTong");

      myTextFrame.contents = myLT_SloganOut.contents;

      myText = myTextFrame.parentStory.paragraphs.item(0)

      myText.fillColor =  myLT_SloganColOut.contents;

      //Right Tongue Slogan  

      myObj = app.activeWindow.activeSpread.pageItems.itemByName("frmRight_Tongue");

      myObj.fillColor=myRT_TongColOut.contents;

      myTextFrame = app.activeDocument.textFrames.itemByName("txtRightTong");

      myTextFrame.contents = myRT_SloganOut.contents;

      myText = myTextFrame.parentStory.paragraphs.item(0)

      myText.fillColor =  myRT_SloganColOut.contents;

       

       

      }

      function myTextContent(myText1)

      {

          var myTextOut = app.activeDocument.textFrames.itemByName(myText1);

          return myTextOut;

      }

       

      Thanks...