Reply To: Script to Replace Existing Paragraph Styles With New Style

#14323822
Peter Kahrel
Participant

Something like the following script changes Arial to Roboto only in paragraphs that use Arial. Dependencies (through basedOn) should carry over. A potential problem is font styles in Arial not present in Roboco, But if you use just, say, Regular and Italic you should be ok. The proof of the pudding…

pstyles = app.activeDocument.allParagraphStyles;<br />
for (i = 1; i < pstyles.length; i++) {<br />
  if (pstyles[i].appliedFont.fontFamily == 'Arial') {<br />
    pstyles[i].appliedFont = 'Roboco';<br />
  }<br />
}

P.

This article was last modified on October 31, 2019

Comments (0)

Loading comments...