Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

format specific words present on a word list

Return to Member Forum

  • Author
    Posts
    • #69770

      Hi to all

      I’ve searched for this, but could’t find it. This is my situation. I have a large file and I need to format certain words in italics or bold. I have the list of words
      that need to be formatted in a separate document.

      How can I ask Indesign to do that, without having to manually create grep styles for each individual word?

      thanks!

    • #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.

    • #69773

      thanks for your help!, I will explore this possibility. Just starting to get acquainted with programming though…

    • #69784
      Gert Verrept
      Member

      you can leave outthe “NR” part, it just changes NR to Nr. The para style to be checked is AM_NL or AM_FR. Maybe that will help you getting started.

Viewing 3 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads