9 Replies Latest reply on May 5, 2016 11:17 PM by karthiks94217840

    Find Language and add insertionPoints.contents

    karthiks94217840 Level 2

      Dear Friends,

       

      I am using multi language books.

       

      I was try to script for just find "German: Old Rules" language and apply colour than paragraph first line and first work before i need to insert the text for <German: Old Rules>. I am using in the below coding colour is apply fine. But, that text not insert. How to insert text friend please suggest.

       

      My Requirements:

       

      1. I need to find Language "German: Old Rules" and apply colour. // This area working fine.

      2. I need insert text "<German: Old Rules>" for apply colour paragraph starting line. // This area not working

       

      app.activeDocument.colors.add ({name:"German: Old Rules",space:ColorSpace.CMYK,colorValue:[20,60,0,0]});
      app.findTextPreferences = NothingEnum.nothing;
      app.changeTextPreferences = NothingEnum.nothing;
      app.findTextPreferences.appliedLanguage = "German: Old Rules"
      app.changeTextPreferences.fillColor = "German: Old Rules"
      var results = app.activeDocument.changeText();
      
      
      for(var i=0;i<results.length;i++)
      {
      try{    
          results[i].textFrames[0].lines[0].insertionPoints[0].contents = "<German: Old Rules>"
      }
      catch(e){}
      
      
      }
      alert("Done")
      

       

      Screen Shot 2016-05-05 at 2.58.48 PM.png

      I need requirements below screen shot:

       

      Screen Shot 2016-05-05 at 2.58.01 PM.png

       

      Please suggest friend how to insert text?

       

      Thanks in Advance