4 Replies Latest reply on May 17, 2014 4:44 AM by hasvi
      • 1. Re: How to find "mypara-firstline-pagenumber" by script
        Chinnadk Level 4

        Hi Hasvi,

         

        The below lines find the page number of the selected paragraph's first line. Hope this helps you.

         

        var selection = app.selection[0]; 

        var lines = selection.paragraphs[0].lines; 

        alert(lines[0].parentTextFrames[0].parentPage.name);

         

        Regards,

        Chinna

        • 2. Re: How to find "mypara-firstline-pagenumber" by script
          hasvi Level 1

          Hi Chinna,

           

          I wrote this script for only one paragraph 'widow & Orphan' line check. pls correct this script for the activeDocument that means I have check all pages and I need the report of Widow and Orphan lines with its pagenumber like 'Widow line--109, Orphan line--105'.

          Is this possible?

           

          This is my script:

           

           

          //Script 1

          //this is find Orphan lines in the selected paragraph

          var getParaFirstLine=app.activeDocument.selection[0].paragraphs[0].lines[0].parentTextFrames[ 0].parentPage.name;

          var getParaSecondLine=app.activeDocument.selection[0].paragraphs[0].lines[1].parentTextFrames [0].parentPage.name;

          {

              if(getParaFirstLine==getParaSecondLine)

              {

                  alert("there is no change")

               }

              else

              {

                  alert("This is Orphan line")

               }

          }

          //Script 2

          //this is find widow lines in the selected paragraph

          var getParaBeforeLineofLastLine=app.activeDocument.selection[0].paragraphs[0].lines[-2].paren tTextFrames[0].parentPage.name;

          var getParaLastLine=app.activeDocument.selection[0].paragraphs[0].lines[-1].parentTextFrames[ 0].parentPage.name;

              {

              if(getParaBeforeLineofLastLine==getParaLastLine)

              {

                  alert("there is no change")

               }

              else

              {

                 alert("This is Widow line")

              }

              }

           

          by

          hasvi

          • 3. Re: How to find "mypara-firstline-pagenumber" by script
            Chinnadk Level 4

            Hi Hasvi,

             

            Replied to your previous thread.

             

            Regards,

            Chinna

            • 4. Re: How to find "mypara-firstline-pagenumber" by script
              hasvi Level 1

              Thanks chinna

               

              Sent from Yahoo Mail on Android