2 Replies Latest reply on Oct 23, 2015 2:04 PM by karthiks94217840

    How to delete select paragraph styles only

    karthiks94217840 Level 2

      Hi Friends,

       

      How to delete select paragraph styles only

       

      Example:

      CO_H3

      COCPN

      COINT1

      COINTT

      Credit line

      Design Matters Head

      Design Mtrs A-Head

      Design Mtrs Hd

      eoc-nl-listitem

      EOU lettered continued

       

      Thanks,

        • 1. Re: How to delete select paragraph styles only
          banl_05 Level 1

          Hi Karthik,

           

          Please try this code

           

          #target indesign     

           

          var allStyles = app.activeDocument.paragraphStyles;     

          var total = allStyles.length;     

          var arrPosition=2; 

           

           

          myInput ();  

           

           

           

           

          function myInput ()

          {

          var myParStylesList = app.activeDocument.paragraphStyles.everyItem().name

           

           

          var w = new Window ("dialog", "Applied ParagraphStyles:");

           

           

          var myInputGroup1 = w.add ("group");

          myInputGroup1.add ("statictext", undefined, "Paragraph style :");

          myInputGroup1.alignment = "left";

          var myDropdown1 = myInputGroup1.add ("dropdownlist", undefined, myParStylesList);

          myDropdown1.selection = 1 ;

           

           

          var myButtonGroup = w.add ("group");

          myButtonGroup.alignment = "right";

          myButtonGroup.add ("button", undefined, "OK");

          myButtonGroup.add ("button", undefined, "Cancel");

           

          w.show ();

           

          r = [myDropdown1.selection.text] ;

           

           

              for (i=2; i<total;i++)

              { 

                   if (allStyles[i].name == r) 

                   {

                       allStyles[i].remove();

                      return r;

                   } 

                   else 

                   {

                     arrPosition+1

                   } 

              }

           

           

           

           

          }

           

          Regards,

          Balaji B.

          • 2. Re: How to delete select paragraph styles only
            karthiks94217840 Level 2

            Hi Balaji,

             

            Your script working good

             

            Thanks

            karthik