1 Reply Latest reply on Mar 27, 2014 9:38 PM by BEGINNER_X

    How to find in script to avoid three continued charcters

    Baskars08

      Hi Everyone

       

       

      I want to identify the continued ther same charecters to avoid in proof reading...

       

       

      Example

       

       

      the sameple test

      the sameple test

      the sameple test

       

       

      Untitled.png

        • 1. Re: How to find in script to avoid three continued charcters
          BEGINNER_X Level 3

          Hi Baskar,

           

          I give the simple coding that helps you to develop your complete requirement.

           

          Please take the concept and re write as per your requirement.

           

          var myLines = app.activeDocument.stories.everyItem().lines.everyItem().getElements();
          
          alert(myLines.length)
          
          for(i=0; i<myLines.length; i++)
          {
              var myLinesWords = myLines[i].words[-1].contents;
              alert("myLinesWords: " + myLinesWords)
              
              try
              {
              if(myLines[i].words[-1].contents == myLinesWords)
              {
                  if(myLines[i+1].words[-1].contents == myLinesWords)
                      {
                      if(myLines[i+2].words[-1].contents == myLinesWords)
                      {
                          alert("same Character")
                          }
                      else
                      {
                          alert("no")
                          }
                      }
                  }
              }
          catch(e){}
              
              }
          

           

          Thanks

          Beginner_X