Okay, time to give up and ask for help....
I'm trying to write an Extendscript that will insert tags around a text style range without picking up the formatting of the text style range. For example, I would like to find the italicized "Photography Theory" in the middle of a paragraph of non-italic text like this:
My own thoughts about the very strange second volume of that series, Photography Theory, are in “Is Anyone Listening?,” Photofile 80 (Winter 2007): 80.
and put "<i> before and "</i>" after it. I am able to add the tags using the insertionPoint object, but the closing tag takes on the formatting of the text style range. Rather, I need it to take on the underlying applied paragraph style with no modifications.
I have tried using insertionPoint.clearOverrides both before and after the insertion of the tag, but that doesn't work.
Because there are too many kinds of "italic" font styles—oblique, cursive, kursive, cursiv, slanted, and on and on—I can't use find/change.
I would be open to using a find routine later in the script that searches for "<i>" and "</i>" and clears the overrides on them, but again, I can't do it with a change function, so I would have to find each tag one at a time then apply a clearOverrides to it. That seems to me like it would be incredibly slow, so I'd rather not go that route. (Also, this is my first Extendscript, and I can figure out how to do the loop that it would iterate through each instance and then stop—I can do it in my sleep with a do loop in VBA, but I'm not there yet with Javascript).
Thanks for any thoughts on how to plant the tag without it picking up overrides.
m.