I'm pretty new to the InDesign scripting thing. A very good programmer previously took care of these at my company but he left and so I need to try to solve some problems related to new work. I've worked with the programmer's files and made some basic changes, but have run into a wall on others. I tried for several hours to solve the problem on my own but cannot. I tried saving these searches as GREP preferences and hoped to be able to convert them but can't figure that out. So I hope someone can help me.
I need my designers to be able to select a text frame and change the font for type formatted within very specific ranges. In this case, I need:
- type with 9pt leading and Interstate BoldCondensed type to be changed to 9 pt leading with Myriad Pro font. (Alternatively, instead of the leading I could have it change all Interstate BoldCondensed font in the paragraph style — my GREP files tell me "zAgate:agateHed" — to Myriad Pro Bold.
and
- type at point size 6.75 ts and Interstate BoldCondensed to change to Myriad Pro bold font.
I guess it comes down to I don't know how to have the script find type that has more than one characteristics and then only change one.
What I've tried:
app.findTextPreferences.pointSize = 6.75;
app.findGrepPreferences.appliedFont = 'InterstateBoldCondensed';
app.changeGrepPreferences.appliedFont = 'Myriad Pro Bold';
app.findGrepPreferences.findWhat = "";
app.changeGrepPreferences.changeTo = "";
myStory.changeGrep();
...and ...
app.findMyTextObject.leading = 9;
app.findGrepPreferences.appliedFont = 'Interstate BoldCondensed';
app.changeGrepPreferences.appliedFont = 'Myriad Pro Bold';
app.findGrepPreferences.findWhat = "";
app.changeGrepPreferences.changeTo = "";
myStory.changeGrep();
...an alternative to the second, using paragraph style rather than leading ...
p.findGrepPreferences.appliedParagraphStyle = "zzAgate:agateHed";
app.changeGrepPreferences.appliedParagraphStyle = "zzAgate:agateHed";
app.findGrepPreferences.appliedFont = 'Interstate BoldCondensed';
app.changeGrepPreferences.appliedFont = 'Myriad Pro Bold';
app.findGrepPreferences.findWhat = "";
app.changeGrepPreferences.changeTo = "";
myStory.changeGrep();
In both cases, it just makes the font change regardless of size or leading.
Thank you in advance for any and all help.