19 Replies Latest reply on Jun 11, 2017 12:18 PM by mordie

    Find and Replace Script for multiple files


      I am trying to find a script that will either open a selection of .ai files or run through all the open files in illustrator and complete a Find and Replace. Right now I have a script that runs the Find and Replace but I have to run it on each document instead of all my open files.


      var openDocument = app.documents.item(0);
      var search_string = /001D/gi; // g for global search, remove i to make a case sensitive search  
      var replace_string = '001E';  
      var text_frames = active_doc.textFrames;  
      if (text_frames.length > 0)  
          for (var i = 0 ; i < text_frames.length; i++)  
                var this_text_frame = text_frames[i];  
                 var new_string = this_text_frame.contents.replace(search_string, replace_string);  
                 if (new_string != this_text_frame.contents)  
                          this_text_frame.contents = new_string;  


      Thanks for any help.