2 Replies Latest reply on Jan 19, 2015 8:53 AM by CambLSAT

    Loop through styles not working as intended.

    CambLSAT

      I'm trying to loop through all the styles in a number of documents and locate any styles with the font "Times New Roman (OTF)." Unfortunately, no matter how I tweak the script, it won't trigger the alert where and when it should. Any ideas? Thanks!

       

      var myDocument = app.activeDocument;
      for (a=1; a < myDocument.allParagraphStyles.length; a++) {
          if(myDocument.allParagraphStyles[a].appliedFont == "Times New Roman (OTF)") {alert()}
          };
      for (b=1; b < myDocument.allCharacterStyles.length; b++) {
          if(myDocument.allCharacterStyles[b].appliedFont == "Times New Roman (OTF)") {alert()}
          };