JS CS3: Help to reduce running time of my script
Hi
We have developed a script to find similiar words/characters at the end/start of 3 or more continous lines. The script has been developed by following steps:
1. Get all lines of the document;
2. Get first 2 characters of first line and compare with next two lines' first 2 characters.
3. If matches, then give a no break before the word to flow.
The same procedure for find end characters of the lines.
As our documents has more than 300 pages, the script runs too long time (about 15 minutes) per document.
Could any suggest to reduce the time of script running?
My basic sript is:
for (k=0; k<myStory.paragraphs.item(i).lines.length; k++) {
var myParaText = myStory.paragraphs.item(i);
var myChar2Fa = myParaText.lines
var myChar2Fb = myParaText.lines[k+1].characters.itemByRange(0,1).texts[0].contents;
var myChar2Fc = myParaText.lines[k+2].characters.itemByRange(0,1).texts[0].contents;
if (myChar2Fa== myChar2Fb && myChar2Fa== myChar2Fc) {
myParaText.lines[k+2].characters[-1].noBreak=true;
}
Kindly suggest.
regards
Masthan