Just putting the script together with instruction as I made reference to it somewhere else. Instructions: Make a find change list either in the script of more efficiently with a tab delimitated .txt excel file Change the file path name in this line var filePath= "c:/Word Change List.txt"; // CHANGE TO CORRECT FILE NAME to the correct path. Make sure to have the / in the right direction. The normal search is semi-case sensitive i.e. will change if pussycat is the change from word then both pussycat and Pussycat would be changed PUSSYCAT or PussyCat would not. If Pussycat was the change word then only Pussycat would be changed and not pussycat. In other words the normal search will replace the word or the word with a capitol letter. If you want only the word changed but not the capitol form i.e. pussycat but not pussy cat then add the ` symbol (above the tab key on my keyboard) like this `pussycat If you want a non case sensitive find replace then add the ~ symbol like this ~pussycat this will change PUssycAt For a grep change add the ; symbol to the beginning of the grep. The excel file should be set up in this form The file doesn't actually have to be made in excell as long as the words are sepertated by tabs and the rows by returns and the file saved as a tab delimitated .txt file Enjoy // Made by Trevor http://forums.adobe.com/message/4602248#4602248 app.findTextPreferences = app.changeTextPreferences = null; app.changeGrepPreferences = app.findGrepPreferences = null; app.findChangeTextOptions.caseSensitive = 1; myDoc = app.documents[0]; /* IF YOU DON'T WANT TO WORK WITH AN EXCEL FILE THEN DELETE THIS LINE !!!!!!! myChanges = [ 'over-sized' , 'oversize', '`pussy cat' , 'pussy', // Pussy cat will stay Pussy cat because of the ` tag 'CAT' , 'CAT®', 'school teacher' , 'schoolteacher', 'high schoolteacher' , 'high school teacher', ';(never)\\-(?=\\S)' , '$1' // Because of the ; (semicolon) tag will be dealt with as a grep ]; */ // IF YOU DON'T WANT TO WORK WITH AN EXCEL FILE THEN DELETE THIS LINE !!!!!!! // /* IF YOU DON'T WANT TO WORK WITH AN EXCEL FILE THEN DELETE THE // AT THE BEGINING OF THIS LINE !!!!!!! var filePath= "c:/Word Change List.txt"; // CHANGE TO CORRECT FILE NAME var txtfFile=new File(filePath); txtfFile.open(); fileContent = txtfFile.read(); txtfFile.close(); var myArrayString=fileContent.replace(/'/g, "QtQeQn4").replace(/\t/g, "','").replace (/\n/g, "' , '"); myArrayString=myArrayString.slice(0,-3); eval ("var myChanges = ['"+myArrayString+"];"); $.writeln(myChanges); for (var c=0; c<myChanges.length-1; c++) myChanges =myChanges .replace(/QtQeQn4/g, "'") // */ IF YOU DON'T WANT TO WORK WITH AN EXCEL FILE THEN DELETE THE // AT THE BEGINING OF THIS LINE !!!!!!! for (var c=0; c<myChanges.length;) { if (myChanges [0] != "`" && myChanges [0] != ";" && myChanges [0] != "~") { app.findChangeTextOptions.wholeWord = 1; app.findTextPreferences.findWhat = myChanges ; app.changeTextPreferences.changeTo = myChanges[c+1]; myDoc.changeText(); capitalChangeFrom = myChanges [0].toUpperCase() + myChanges .slice(1,myChanges .length); capitalChangeTo = myChanges[c+1][0].toUpperCase() + myChanges[c+1].slice(1,myChanges[c+1].length); app.findTextPreferences.findWhat = capitalChangeFrom; app.changeTextPreferences.changeTo = capitalChangeTo; myDoc.changeText(); } else if (myChanges [0] == "`") { app.findChangeTextOptions.wholeWord = 1; app.findTextPreferences.findWhat = myChanges .slice(1,myChanges .length); app.changeTextPreferences.changeTo = myChanges[c+1]; myDoc.changeText(); } else if (myChanges [0] == "~") { app.findChangeTextOptions.wholeWord = 0; app.findTextPreferences.findWhat = myChanges .slice(1,myChanges .length); app.changeTextPreferences.changeTo = myChanges[c+1]; myDoc.changeText(); } else { app.findGrepPreferences.findWhat = myChanges .slice(1,myChanges .length); app.changeGrepPreferences.changeTo = myChanges[c+1]; myDoc.changeGrep(); } c+=2; }
... View more