Script for finding and changing character style based on paragraph style font

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Script for finding and changing character style based on paragraph style font

Viewing 1 reply thread
  • Author
    Posts
    • #1229077
      N W
      Member

      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.

    • #14323068
      N W
      Member

      Got the answer on a different message board, if this helps anyone else: https://community.adobe.com/t5/indesign/script-for-finding-double-applied-italics/m-p/10930240?page=1#M175795

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
>