Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Why this script unfunction?

$
0
0

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


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>