0

I'm pretty new to InDesign scripting and want to do the following. I have headlines with a style called h2 applied to. How can I get a collection of all these instances for manipulation? Thank you.

jhuk
  • 103
  • 1

1 Answers1

0

var props = {
  appliedParagraphStyle : "h2",
  findWhat = ".+";
 }
app.findGrepPreferences = null;
app.findGrepPreferences.properties = props;

var found = app.activeDocument.findGrep();
var n = found.length;
while (n--) {
  
  //do something with instance n of found 
  //which is a text object
  found[n].contents="Found you !";
}
Loic
  • 2,173
  • 10
  • 13