search and apply two paragraph styles using GREP
hi all,
i trying find , apply 2 paragraph styles within 1 stroke using script
<chout>chapter outline 1.1 breif history 1.2 characteristics of beverages 1.3 classification of beverages 1.3.1 non-alcoholic beverages 1.3.2 alcoholic beverages</chout>
i using below script apply style. not work please me..
app.findgreppreferences = nothingenum.nothing; app.changegreppreferences= nothingenum.nothing; app.findgreppreferences.findwhat= "<chout>(.*?)<\/chout>"; myresults=app.activedocument.findgrep(); (i = 0; <= myresults.length - 1; i++) { myresults[i].appliedparagraphstyle = app.activedocument.paragraphstyles.item("bl_f"); myresults[i].paragraphs[0].appliedparagraphstyle = "bl_f"; } //app.changetext(undefined, false, false, undefined,{},{});
thanks
karthik
the dot (.) doesn't match returns (\r) @ end of each line. add (?s) in front of expression. there's no need parentheses (they make expression less efficient), , can use .+ (one or more) instead of .* (zero or more) -- unless of course want match 0 characters between tags. use expression:
"(?s)<chout>.+?<\/chout>"
peter
More discussions in InDesign Scripting
adobe
Comments
Post a Comment