6 Replies Latest reply on Nov 17, 2016 3:33 AM by Obi-wan Kenobi

    paragraph rules


      Hi all,


      kindly i'm asking about who to reverse " paragraph rules" values for (Right/Left indent) as shown:


      for ex, Left indent = 1 and Right indent = 3 then after script be reversed Left = 3 and Right = 1 and i hope that go through all paragraph styles and non styles text too


      with Rule above or below




      any hint please





        • 1. Re: paragraph rules
          Obi-wan Kenobi Level 5

          Hi Suzan,


          You could work a little with this:







          See:  InDesign ExtendScript API (11.0)



          1 person found this helpful
          • 2. Re: paragraph rules
            Suzan.V Level 1

            Hi Obi,


            Thanks for your reply, i will try to find it out using your hint and i hope i get it fast, if don't i will be grateful to back to you again





            • 3. Re: paragraph rules
              Suzan.V Level 1

              many thanks to you Obi my dear, i did it and worked well


              Best Regards



              • 4. Re: paragraph rules
                Obi-wan Kenobi Level 5

                Something simply like this:


                myParas = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();  
                for (P = 0; P < myParas.length; P++)  
                    var AL = myParas[P].ruleAboveLeftIndent;  
                    var AR = myParas[P].ruleAboveRightIndent;
                    var BL = myParas[P].ruleBelowLeftIndent;  
                    var BR = myParas[P].ruleBelowRightIndent;
                    myParas[P].ruleAboveLeftIndent = AR;
                    myParas[P].ruleAboveRightIndent = AL;
                    myParas[P].ruleBelowLeftIndent = BR;
                    myParas[P].ruleBelowRightIndent = BL;




                • 5. Re: paragraph rules
                  Suzan.V Level 1

                  Hi Obi,


                  well i tried your code but nothing changed for each right and left indent and i see that your code make my paragraph styles seems to be override !!


                  i wrote this code and seems working well for me, you can check too



                  var myDoc = app.activeDocument;
                  var myPStyle = myDoc.allParagraphStyles;
                  for(i=1; i<myPStyle.length; i++){
                       var  ruleAboveRightIndentVal = myPStyle[i].ruleAboveRightIndent;  
                       myPStyle[i].ruleAboveRightIndent = myPStyle[i].ruleAboveLeftIndent;  
                        myPStyle[i].ruleAboveLeftIndent =ruleAboveRightIndentVal;  
                          var  ruleBelowRightIndentVal = myPStyle[i].ruleBelowRightIndent;  
                       myPStyle[i].ruleBelowRightIndent = myPStyle[i].ruleBelowLeftIndent;  
                        myPStyle[i].ruleBelowLeftIndent =ruleBelowRightIndentVal;  




                  • 6. Re: paragraph rules
                    Obi-wan Kenobi Level 5



                    Alas, not so simple!


                    Here, 4 paras: in black color, "standard" para style (no para rules in settings) but manually done ; in red color, a para style with para rules in settings, "pure" in the first para, manually modified in the second one.


                    1/ Before scripts:


                    Capture d’écran 2016-11-17 à 12.22.02.png


                    2/ After mine, the 4 paras have been treated, but overridden:


                    Capture d’écran 2016-11-17 à 12.22.26.png


                    3/ With yours, "black" paras no treated, first "red" para = "pure" para style ( the style has been correctly updated), second "red" para: no correct result:


                    Capture d’écran 2016-11-17 à 12.23.05.png