2 Replies Latest reply on Aug 25, 2015 7:49 AM by selvam214

    Nested overrides

    selvam214 Level 1

      Hi All,

      If possible to find the nested style's override (contents) with script?

       

      Example here:

      1. The first line is Nested.

      2. the italic word is nested override.

       

      Screen shot 2015-08-24 at 3.27.11 PM.png

        • 1. Re: Nested overrides
          milligramme Level 3

          Hi, try this code.

          styleOverridden property will help you to found overriden

           

          var doc = app.documents[0];
          var story = doc.stories[0];
          var tsr = story.textStyleRanges;
          
          for (var i=0, len=tsr.length; i < len ; i++) {
            if (tsr[i].styleOverridden) {
              $.writeln(tsr[i].contents);   
              $.writeln(tsr[i].index);   
            }
          };
          

           

          thankyou

          • 2. Re: Nested overrides
            selvam214 Level 1

            Hi Milligramme,

            Thank you so much for your help, your effort more valuable for me.

             

             

             

             

             

            Here is my target.

             

             

            var doc = app.activeDocument; 
            var story = doc.stories.everyItem().getElements(); 
            for (i=0; i<story.length; i++)
            {
                var tsr = story[i].textStyleRanges;
                for (j=0; j<tsr.length; j++)
                {
                    if (tsr[j].styleOverridden)
                    {
                        if (tsr[j].paragraphs[0].nestedStyles.length!=0)
                        {
                    alert(tsr[j].parentTextFrames[0].parentPage.name+"\t"+tsr[j].contents)
                    }
                        }
                    }
                }

             

             

            Thanks,

            Selva