Skip to main content
August 2, 2011
Question

Find /change batch in InDesign CS5

  • August 2, 2011
  • 1 reply
  • 1301 views

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!

This topic has been closed for replies.

1 reply

Mac_06
Inspiring
August 3, 2011

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;
                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);
        }
  

August 3, 2011

Thanks! I'll try it out!