2 Replies Latest reply on Jun 14, 2015 1:02 PM by Peter Kahrel

    JS to find and replace the character/paragraph style combinations

    prajant55419008

      Hi All,

       

      I am new to ID and JS. I am just started my job now. I am trying to learn the indesign/JS.

       

      Here below what I am trying is to write a script to find and change the character/paragraph style combinations. my code is below,

       

       

       

      app.findTextPreferences = app.changeTextPreferences = null; 

      app.findTextPreferences.appliedParagraphStyle = "H1";

      app.findTextPreferences.appliedCharacterStyle = "bold";

      var myF = app.activeDocument.selection[0]; //make sure you are inside a text frame when running the script  .parentStory.findText(true)

      {

      for (var i = 0; i < myF.length; i++)

      app.changeTextPreferences.appliedCharacterStyle = "bold underline";

      }

       

       

      alert("All done!\nYou can go outside and play now!"); 

       

      I have not seen any result in this.

       

      PS: I am using Extendscript tool for above code.