2 Replies Latest reply on Aug 3, 2011 10:02 AM by CLY1290

    Find /change batch in InDesign CS5

    CLY1290

      I understand that scripts can be written to batch find/change. I see where the file is under utilities and I'm sure it's very simple to someone familiar with scripting, but I'm not a programmer so was wondering if someone would write thi

      s for me. I need to find two spaces and replace with one;

      find two periods and replace with one; find 1/4 and replace with ALT+0188; find "-ALT+188" and replace with ALT+0188

      ; find 1/2 and replace with ALT+0189; find "-ALT+189" and replace with ALT+0189; find 3/4 and replace with ALT+1090; find "-ALT+190" and replace with ALT+0190; find ".net."and replace with .net; find ".com" and replace with .com; find ".org." and replace with .org; find paragraph style "Boxed Ad" and replace with "Classified"; find format Helvetica, Bold, Center and replace with paragraph style "Bold Center".

       

      I'm very grateful to anyone who can help!

       

       

       

        • 1. Re: Find /change batch in InDesign CS5
          Mac_06 Level 2

          This is required very minimal scripting knowledge.

          Open all document required to find change stuff and run below javascript code

           

                      var ReplaceArray = [["  ", " "], ["..", "."], ["1/4", "ALT+0188"], ["1/2", "ALT+0189"], 
                                                      ["-ALT+188", "ALT+0188"], ["-ALT+189", "ALT+189"], ["3/4", "ALT+1090"], ["-ALT+190", "ALT+0190"],
                                                      [".net.", ".net;"], [".com", ".com;"], [".org.", ".org;"]];
                      for(j=0; j<ReplaceArray.length; j++)
                      {
                          var curArray = ReplaceArray[j];
                          ChangeInStory(curArray[0],  curArray[1])
                      }
          
          function ChangeInStory(find_text, change_text, findType){
              try{
                  app.findTextPreferences = app.changeTextPreferences = null;
                  
                  app.findChangeTextOptions.wholeWord = false;
                  app.findChangeTextOptions.caseSensitive = true;
                  
                  app.findTextPreferences.findWhat= find_text;
                  app.changeTextPreferences.changeTo = change_text;
                  app.changeText();
          
                  app.findTextPreferences = app.changeTextPreferences = null;
                  }
              catch(e)
              {
                      throw (e);
                  }
              }
                  try
                  {
                  app.findTextPreferences = app.changeTextPreferences = null;
                  app.findTextPreferences.appliedParagraphStyle= "Boxed Ad";
                  app.changeTextPreferences.appliedParagraphStyle = "Classified";
                  
                  app.changeText();
                  app.findTextPreferences = app.changeTextPreferences = null;
                  }
              catch(e){
                      throw (e);
                  }
                  
                  
                 try
                  {
                  app.findTextPreferences = app.changeTextPreferences = null;
                  app.findTextPreferences.appliedFont= "Helvetica LT Std";
                  app.findTextPreferences.fontStyle= "Bold Condensed";
                  app.findTextPreferences.characterAlignment= CharacterAlignment.ALIGN_EM_CENTER;
                  app.changeTextPreferences.appliedParagraphStyle = "Bold Center";
                  
                  app.changeText();
                  app.findTextPreferences = app.changeTextPreferences = null;
                  }
              catch(e){
                      throw (e);
                  }
             
          
          • 2. Re: Find /change batch in InDesign CS5
            CLY1290 Level 1

            Thanks! I'll try it out!