7 Replies Latest reply on Aug 15, 2016 6:55 AM by cweeks

    More than one OR operator?

    cweeks Level 1

      My company produces long newsletters, that pull in stories and tab-separated tables, auto-formatted with Xtags by Em Software.

       

      My problem is, one of our tables sources changed recently, and is pulling in very long job titles instead of the shortened ones we used to get.

       

      I wrote a script to search the document by paragraph style and do a find a replace for several keywords so I can use abbreviations. I tried to learn as much as I could just to fix this one problem. I don't have much knowledge in this field.

       

      It works great, except when I add a second "or" || operator. There must be another way to do this. The script doesn't error out. It just ignores my 3rd condition. See below. The problem is the 3rd one "Vice Pres" gets ignored. Any advice?

       

      Forgive my ignorance. Thanks!

       

      replaceTextVP ("Vice President" || "Vice Pr" || "Vice Pres" , "VP");
      
      
      function replaceTextVP (input, output)
      {
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
          app.findTextPreferences.findWhat = input;
          app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("INSIDE_LINE");
          app.changeTextPreferences.changeTo = output;
          app.activeDocument.changeText();
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing; 
      }