So I tried putting together all the scripts from this forum to create one single script that will: Go through all my open documents Search and replace multiple queries based on my json objects The problem with the script below is that it will only replace the text if the entire text frame matches the query. I need all or PART of the text to match the query. How would I do that? #target Illustrator function FindAndReplaceScript_AllOpenDocuments(){ for(var m=app.documents.length -1; m > -1; m--){ app.documents .activate(); var active_doc = app.documents ; var text_frames = active_doc.textFrames; var allSearchReplaceStrings = [ { "search": "text1", "replace": "replace1" }, { "search": "text2", "replace": "replace2" }, ]; var this_text_frame, thisSearchReplacePair; for (var i = 0 ; i < text_frames.length; i++) { this_text_frame = text_frames; for(var j = 0; j < allSearchReplaceStrings.length; j++){ thisSearchReplacePair = allSearchReplaceStrings ; if(this_text_frame.contents == thisSearchReplacePair.search){ this_text_frame.contents = thisSearchReplacePair.replace; } } } } }; FindAndReplaceScript_AllOpenDocuments();
... View more