2 Replies Latest reply on Aug 23, 2014 10:46 AM by BEGINNER_X

    Bullet style

    kanaga kumar

      Dear Friends;

       

      I am the beginner in javascript, my request is applied all bullet paras applied paragraph style is "CN":

       

      var myDoc = app.documents.item(0);

      var myPages = myDoc.pages.textFrames.everyItem().paragraphs.everyItem().getElements();

      for (i =0; i<myPages.length; i++)

      {

      var myPage = myPages [i];

      {

      if (myPage == bulletsAndNumberingListType.BULLET_LIST.appliedParagraphStyle.name("BL"))

          }

      }

       

      It is shows error.

       

      Thanks

      kanaga kumar. k

        • 1. Re: Bullet style
          [Jongware] Most Valuable Participant

          Tip for beginners:

           

          NEVER, EVER SAY "IT SHOWS AN ERROR"

           

          without saying what error. It is right there, on your screen. Why not tell us what it says?

           

          You may say, "if you run my script you will see it" but that is not true. Here is an example: I run your script and I get the error:

           

          Object is invalid

          (..) Line: 2

           

          THat is because I did not have a document open when running. (And if this is your error as well, the solution is simple.)

          • 2. Re: Re: Bullet style
            BEGINNER_X Level 3

            Hi Kanaga Kumar,

             

            Try the below code:

             

            app.findGrepPreferences = app.changeGrepPreferences = null;    
            
            app.findGrepPreferences.bulletsAndNumberingListType = ListType.BULLET_LIST;
            
            app.changeGrepPreferences.appliedParagraphStyle = "CN";
            
            app.activeDocument.changeGrep();
            
            alert("Process Completed")
            

             

            Regards

            Siraj