I need to find instances where a character style <ITAL> is applied to text within any paragraph style defined as Italic in Font Style, and switch that character style to a roman character style <roman>. The paragraph style needs to stay untouched. Both character styles are already defined in the document.
So, for instance, where paragraph styles <p1> and <p3> have Italic defined in Font Style
Before:
<p1>The quick brown fox jumps <ITAL>over</ITAL> the lazy dog.</p1>
<p2>The quick brown fox jumps <ITAL>over</ITAL> the lazy dog.</p2>
<p3>The quick brown fox jumps <ITAL>over</ITAL> the lazy dog.</p3>
After:
<p1>The quick brown fox jumps <roman>over</roman> the lazy dog.</p1>
<p2>The quick brown fox jumps <ITAL>over</ITAL> the lazy dog.</p2>
<p3>The quick brown fox jumps <roman>over</roman> the lazy dog.</p3>
I can do a Find/Change for each paragraph style, but would like to do this in one step, where I find all paragraph styles defined as Font Family Italic that contain text with the character style <ITAL>. Basically: If [character style: ITAL] is found in [Any Paragraph Style] that has [Italic] defined in Font Style, then replace [character style: ITAL] with [character style: roman].
I am a novice at scripting from scratch. I can edit… I use scripts and GREP quite extensively, I’m just not great at javascript.