3 Replies Latest reply on Mar 22, 2017 8:47 AM by tpk1982

    More than 3 hyphen

    Sen.Soft Level 1

      Hi anyone can help me on this, We have some set pages on that. Each page should have only 3 hyphen is allowed. If more than three hyphen it will need to shows an alert with the page number.


      Example : Page : 33 have 5 hyphen then the alert shows : Page 33 have more hyphen.

        • 2. Re: More than 3 hyphen
          Sen.Soft Level 1

          hi thanks for the reply, but in a page only 3 hyphen is allowed, whether they  come together (line by line) or any where in the page.


          Example :


          1st hyphen comes in 4th line.

          2nd hyphen comes in 8th line.

          3rd hyphen comes in 19th line.


          If 4th hyphen comes in 20th line or any. Need to show alert as 'Page contain more than 3 hyphen'.

          • 3. Re: More than 3 hyphen
            tpk1982 Level 4

            Just to start.. try and modify as you need..


            var doc = app.activeDocument,    
                mystories = doc.stories;    
                var myarray=[];
            for(var i=0;i<mystories.length;i++)    
                    var myline = mystories[i].lines;    
                    for(var j=0;j<myline.length;j++)    
                            if(myline[j].words[-1].lines.length >=2)  
             alert(myarray.length+" Hyphens in Page: " +doc.pages[0].name)  
            else{ alert("No Error")}