I have the small trick for the above request. try this.
app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing; app.findGrepPreferences.findWhat = "(?i)(your|you|our)"; app.findGrepPreferences.fontStyle = "Regular"; app.changeGrepPreferences.fillColor = "Red" app.changeGrep(); app.findGrepPreferences = NothingEnum.nothing; app.changeGrepPreferences = NothingEnum.nothing;
No chance to work this way.
(I mean Shilpa way, didn,t see your answer csm_phil )
1. mytexts suppose to be an array to iterate into. Otherwise you are iterating through characters, one by one.
so make it mytexts = mytexts.split("|"); // here is an array
2. you have to find every occurence of each "mytexts" element inside your doc to check if CharStyle is added;
then you can use find...change to reach your goal.
So make inside your "for_loop":
app.findTextPreferences = null;
app.changeTextPreferences = null;
app.findTextPreferences.findWhat = mytext;
app.findTextPreferences.fontStyle = "Regular"; //are you sure "Regular" fontStyle is a good sign for action?
app.changeTextPreferences.fillColor = "Red"; //make sure there is "Red" color in your doc
this should work.
Message was edited by: Jump_Over
thanks very much, for the edits, it also works now as that of csm_phil.
what is the difference between, csm_phil find and change comparig with yours.
It would be great if i have clear update on your..
thanks in advance..
Phil way is a smarter one.
It find all occurences of your text (match case switched off) using GREP regular expression (all at once) and change it in the same step (all at once).
app.changeGrep();do it in every document currently opened in InDesign.
a great explanations....