Hi, everyone
can you find the wrong syntax of this script, and help me to fix it?
app.findGrepPreferences = app.changeGrepPreferences = null;
var doc = app.activeDocument,
_selection = app.selection[0].words;
var ignoreWords = "a, an, and, the, to, with, in, on, as, of, or, at, into, by, from, their, then, for, are, that, is, be";
app.findGrepPreferences.appliedParagraphStyle = "01 H1";
finds = app.selection[0].findGrep();
for(var i=0;i<finds.length;i++){
if(ignoreWords.indexOf(_selection[i].contents) == -1)
{
finds[i].texts[0].changecase(ChangecaseMode.titlecase);
}
}
app.findGrepPreferences = app.changeGrepPreferences = null;
John