Reply To: format specific words present on a word list

Home Page / Forums / General InDesign Topics (CLOSED) / format specific words present on a word list / Reply To: format specific words present on a word list

#69772
Gert Verrept
Member

I think a script can help you. I just have part of the script by hand, but I’m sure someone on the forum can do more with it.
Basically, it searches in a txt-file for words, and when a para style is applied to the sentences where the word is found it applies the character style “vet”.
here’s the function

//find and replace
function zoek_en_vervang() {

var aantal_zoek_strings = zoek_lijst.length;

for (j=0; j<aantal_zoek_strings; j++) {

app.findTextPreferences.findWhat = NothingEnum.nothing;
app.changeTextPreferences.changeTo = NothingEnum.nothing;

if (zoek_lijst[j] == “NR1”) {
zoek_string = app.findTextPreferences.findWhat = zoek_lijst[j];
vervang_string = app.changeTextPreferences.changeTo = “Nr. 1”;
vervang = app.activeDocument.changeText();
} else {
zoek_string = app.findTextPreferences.findWhat = zoek_lijst[j];
app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item(“AM_FR”);
vervang_string = app.changeTextPreferences.changeTo = zoek_lijst[j];
app.changeTextPreferences.appliedCharacterStyle = “vet”;
vervang = app.activeDocument.changeText();

app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item(“AM_NL”);
vervang = app.activeDocument.changeText();
}

app.findTextPreferences.findWhat = NothingEnum.nothing;
app.changeTextPreferences.changeTo = NothingEnum.nothing;

}

}

Hope someone else can help you further. He has to tell the script where to find the txt-file and insert the function.

This article was last modified on July 30, 2014

Comments (0)

Loading comments...