-1

Is there a way to find two options using the app.findGrepPreferences in InDesign JavaScript?

For example how to find all SmallCaps text that is underlined and italic? I only know the code to find small caps, which is :

app.findGrepPreferences.capitalization = Capitalization.smallCaps
Raptor
  • 53,206
  • 45
  • 230
  • 366
hale
  • 171
  • 2
  • 5
  • 12

2 Answers2

2

You will have to set these options one by one and then do the search. For a reference of the option properties see the findGrepPreferences class reference.

This should do what you are asking for:

var doc = app.activeDocument;

app.findGrepPreferences.capitalization = Capitalization.SMALL_CAPS;
app.findGrepPreferences.underline = true;
app.findGrepPreferences.fontStyle = "Italic";

var results = doc.findGrep();
mdomino
  • 1,195
  • 1
  • 8
  • 22
0

What about:

var doc = app.activeDocument;

app.findGrepPreferences.properties = {
  capitalization: Capitalization.SMALL_CAPS,
  underline: true, 
  fontStyle: "Italic"
};

var results = doc.findGrep();
Moritz Ringler
  • 9,772
  • 9
  • 21
  • 34