2 Replies Latest reply on Nov 1, 2013 2:28 AM by BEGINNER_X

    How we find bullet list

    AshokJithan

      How we find the bullet list para in stories?

        • 1. Re: How we find bullet list
          Sajeev Sridharan Level 4

          Try this,

           

          var myDoc = app.activeDocument;

          var myParagraph = app.selection[0].paragraphs[0];

          if (myParagraph.bulletsAndNumberingListType == ListType.bulletList)

          {

               // do your stuff

               alert("the selected paragraph is bullet list");

          }

           

           

          Vandy

          • 2. Re: How we find bullet list
            BEGINNER_X Level 3

            Hi Ashok,

             

            Try the below code may it should be helpful,

             

             

            //Way 1
            var myDoc = app.activeDocument;
            
            var myStories = app.activeDocument.stories.everyItem().getElements();
            
            alert(myStories.length)
            
            for(k=myStories.length-1; k>0; k--)
            {
                if(myStories[k].bulletsAndNumberingListType == ListType.bulletList)
                {
                    alert("First Para: " + myStories[k].paragraphs[0].contents)
                    alert("Last Para: " + myStories[k].paragraphs[-1].contents)
                    }
            }
            
            
            //Way 2 Very Fast while process the script
            
            app.findTextPreferences.bulletsAndNumberingListType = ListType.BULLET_LIST;
            
            var myFound = app.activeDocument.findText();
            
            alert(myFound.length)
            
            for(k = 0; k<myFound.length; k++)
            {
                alert(myFound[k].paragraphs[0].contents)
                }
            

             

            Thanks

            Beginner_X