2 Replies Latest reply on Dec 28, 2010 12:11 AM by albanx

    textStyle compare

    albanx Level 1


      Is there any way via javascript, to find differences betwen two different textStyles?


      var document=app.activeDocument
      var layer1=document.layers[0];
      var textframe=layer1.textFrames[0];
      var ran=textframe.textStyleRanges;


      var textS1=ran[0];
      var textS2=ran[1];


      How can I find or compare textS1 and textS2 style?



        • 1. Re: textStyle compare
          milligramme Level 3


          try to add this code after your code.

          if there is difference between Style1 and 2,

          InDesign will show alert "property name, textS1 value, textS2 value"



          var arr = [];
          var prop_1 = textS1.properties;
          var prop_2 = textS2.properties;
          for ( i in prop_1) {
               if(prop_1[i] !== prop_2[i]){
                    arr.push(i + ": " + prop_1[i] + "\t" + prop_2[i]);




          1 person found this helpful
          • 2. Re: textStyle compare
            albanx Level 1

            Thank you your answer is perfect, i accidentally press helpfull answer instead of perfect answer.