Question
batch find & replace text in Illustrator files in a folder?
I found this script which work greats on any currently open Illustrator files, but I would like it to be able to run the action on a Mac OS folder, open the first Illustrator, runs this javascript, save & close that file, then loop through all other Illustrator files in a folder and repeat the process, until the last file.
- function FindAndReplaceScript_AllOpenDocuments(){
- for(var i=app.documents.length -1; i > -1; i--){
- app.documents.activate();
- var aDoc = app.documents;
- var searchString = /VT/gi;
- var replaceString = ‘VHB';
- var theTF = aDoc.textFrames;
- if (theTF.length > 0) {
- for (var j = 0 ; j <theTF.length; j++) {
- var aTF = theTF
; - var newString = aTF.contents.replace(searchString, replaceString);
- if (newString != aTF.contents) {
- theTF
.contents = newString; - }
- }
- }
- }
- };
- FindAndReplaceScript_AllOpenDocuments();
