3 Replies Latest reply on Feb 11, 2013 11:40 PM by BEGINNER_X

    Doubt in textframe ID

    BEGINNER_X Level 3

      Hi,

       

      I want to get  contents of first line of first three words and last line of last three words in the text frame with ID.

       

      Report i want to generate is: Page number + Text Frame ID + first line three words contents + last line three words contents

       

      Except Text Frame ID i got the remaining reports

       

       

      Trying script:

       

      var myDoc = app.activeDocument

       

      var myPages = myDoc.pages.everyItem().getElements()

       

      var myTextFrames = myDoc.textFrames.everyItem().getElements()

       

      Contents1 = new Array      //First line and First three words of textframe

       

      Contents2 = new Array      //Last line and Last three words of textframe

       

       

      myTFPages = new Array     //Selecting text frame page number

       

       

       

      for(i=0; i<myPages.length; i++)

      {

          for(i=0; i<myTextFrames.length; i++)

          {

              var firstLine_Contents = myTextFrames[i].lines[0].words.itemByRange(0, 2).contents;

       

              Contents1.push(firstLine_Contents)       //array 1

       

              alert(Contents1);

       

      //Doubt in below lines


      //~         var myFL_ID = firstLine_Contents.parentTextFrames[0].id


      //~         alert(myFL_ID.id)

      //~        

               var lastLine_Contents = myTextFrames[i].lines[-1].words.itemByRange(-1, -3).contents;

       

                Contents2.push(lastLine_Contents)     //array 2

       

                alert(Contents2)

       

              }

              }

       

       

      Can any one help me how to generate text frame id + first line three words contents + last line three words contents

       

      Thanks in advance

      BEGINNER

        • 1. Re: Doubt in textframe ID
          Jump_Over Level 5

          BEGINNER_X wrote:

           

                  var firstLine_Contents = myTextFrames[i].lines[0].words.itemByRange(0, 2).contents;

          ...

                  var myFL_ID = firstLine_Contents.parentTextFrames[0].id

           

          Notice that firstLine_Contents is a string. Just string, no parentTextFrame, no more text properties.

          Use:

          var myFL_ID = myTextFrames[i].id

           

          rgds

          1 person found this helpful
          • 2. Re: Doubt in textframe ID
            BEGINNER_X Level 3

            Hi Jump_over/ALL,

             

            Thanks for your reply.......

             

            Above mentioned ID concept working fine for me so that i created the script and produce the report in .txt file in the name of REPORT1

             

            REPORT1 includes Page number + TextFrames ID +  FirstLine Contents + LastLine Contents

             

            Is it possible to compare two text files?

             

             

            After making author correction the user run the same script and produce the report in the name of REPORT2

             

            REPORT2 includes Page number + TextFrames ID +  FirstLine Contents + LastLine Contents

             

             

            But my question or doubt:

             

            If any discrepancy between the two reports (REPORT1 and REPORT2) i want to hightlight color where the changes will happen.

             

             

            Can anyone help me.

             

            Thanks in advance

            BEGINNER

            • 3. Re: Doubt in textframe ID
              BEGINNER_X Level 3

              Hi All/JUMP_OVER,

               

              I got the answer.

               

              Thank you to all supporters.

               

               

              Thanks in advance

              BEGINNER