10 Replies Latest reply on Nov 20, 2012 7:13 AM by darrylrc1105

    Changing manually applied Paragraph Rules

    darrylrc1105

      Is there a script out there that will find paragraph rules below 1pt and change them to a specified point size.

       

      We have hundreds of pages with hundreds maybe thousands of paragraph rules that are manually added cmd+alt+j, all below 1pt.

       

      We are screen printing these lines sometimes reversed out of Dark Grey or just printed light brown, onto 440mic PVC, if they are below 1pt they just fill in on the screen, so it would be handy to have a script that can find all these rules and change them automatically, saving hours and hours of manually changing all of these, after somebody has already gone in and created all of these.

       

      We are using Indesign 5.5 on an Imac

       

      Thanks in Advance

      Darryl

        • 1. Re: Changing manually applied Paragraph Rules
          [Jongware] Most Valuable Participant

          There is not a script that I know of, but writing one is a piece of cake:

           

          weight = Number(prompt ("New rule weight", "1"));
          pars = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();
          l = pars.length;
          for (i=0; i<l; i++)
          {
           if (pars[i].ruleAbove && pars[i].ruleAboveLineWeight < 1) pars[i].ruleAboveLineWeight = weight;
           if (pars[i].ruleBelow && pars[i].ruleBelowLineWeight < 1) pars[i].ruleBelowLineWeight = weight;
          }
          

           

          Is this the same query as on InDesignSecrets? I asked for some more detail but you didn't get back on that.

          • 2. Re: Changing manually applied Paragraph Rules
            Trevorׅ Adobe Community Professional

            Darryl

            It could take some (a heck of a lot) of time on long documents but it will be a lot quicker than doing it manually

            // By Trevor http://forums.adobe.com/thread/1099425?tstart=0
             #target indesign
            #targetengine main
            redraw = app.scriptPreferences.enableRedraw;
            app.scriptPreferences.enableRedraw =0; // speeds up script
            app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Adjust Paragraph Rules");
            app.scriptPreferences.enableRedraw =redraw;
            function main()
            {
                var doc = app.activeDocument;
                var tr = doc.stories.everyItem().textStyleRanges.everyItem().getElements();
                var tl=tr.length-1
                while (tl--)
                {
                    if (tr[tl].ruleAboveOffset < 1 && tr[tl].ruleAbove) tr[tl].ruleAboveOffset = 1; // Change as required
                    if (tr[tl].ruleBelowOffset < 1 && tr[tl].ruleBelow) tr[tl].ruleBelowOffset = 1; // Change as required
                }
            }
            
            
            • 3. Re: Changing manually applied Paragraph Rules
              Trevorׅ Adobe Community Professional

              Hi Jongware

               

              I didn't see your answer there when I posted mine.

              AGAIN I MADE THAT STUPID TEXTRANGE ERROR

              Here's the correction

              • 4. Re: Changing manually applied Paragraph Rules
                Trevorׅ Adobe Community Professional

                // By Trevor http://forums.adobe.com/thread/1099425?tstart=0
                #target indesign
                #targetengine main
                redraw = app.scriptPreferences.enableRedraw;
                app.scriptPreferences.enableRedraw =0; // speeds up script
                app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Adjust Paragraph Rules");
                app.scriptPreferences.enableRedraw =redraw;
                function main()
                {
                    var doc = app.activeDocument;
                    var tr = doc.stories.everyItem().paragraphs.everyItem().getElements();
                    var tl=tr.length-1
                    while (tl--)
                    {
                        if (tr[tl].ruleAboveOffset < 1 && tr[tl].ruleAbove) tr[tl].ruleAboveOffset = 1; // Change as required
                        if (tr[tl].ruleBelowOffset < 1 && tr[tl].ruleBelow) tr[tl].ruleBelowOffset = 1; // Change as required
                    }
                }

                • 5. Re: Changing manually applied Paragraph Rules
                  darrylrc1105 Level 1

                  Hi

                   

                  Sorry didn't get back, been away for a couple of days, yes this is the same as on Indesign Secrets

                   

                  .. The missing detail is "What do you actually change, then?"

                   

                  We select the para rules by cmd+alt+j and if they are below 1pt (they vary sometimes .3pt, .4pt, .6pt and so on, we then change them to 1pt).

                   

                  "A piece of cake" to someone you knows what they are doing 

                   

                  Thanks to you both I will give them a go and let you know how I get on, a lot less heartache, I hope

                   

                  Thanks again

                  Darryl

                  • 6. Re: Changing manually applied Paragraph Rules
                    Trevorׅ Adobe Community Professional

                    Hi Darryl

                     

                    After seeing Jongware script I see he understood that you were referring to the ruleAboveLineWeight and not the
                    ruleAboveOffset so  change the script according to what you need.

                     

                    The enwrapping of the script with the doScript FAST_ENTIRE_SCRIPT undo mode should make a significant improvement to it's performance

                     

                    Trevor

                    • 7. Re: Changing manually applied Paragraph Rules
                      darrylrc1105 Level 1

                      Thanks for all your help here, but its actually the rule below line weight I need to change, the offset needs to stay at its original amount.

                       

                      Can I search for a variable in my documents, I mean, any line weight below 1pt and change it to 1pt.

                       

                      Now this is where I feel stupid, but "how do I run the script".     

                       

                      Thanks advance

                      Darryl

                      • 8. Re: Changing manually applied Paragraph Rules
                        [Jongware] Most Valuable Participant

                        darrylrc1105 wrote:

                         

                        Thanks for all your help here, but its actually the rule below line weight I need to change, the offset needs to stay at its original amount.

                        Can I search for a variable in my documents, I mean, any line weight below 1pt and change it to 1pt.

                         

                        My script does exactly that.

                         

                        darrylrc1105 wrote:

                         

                        Now this is where I feel stupid, but "how do I run the script".     

                         

                        There's a first time for everything! Read http://indesignsecrets.com/how-to-install-a-script-in-indesign-that-you-found-in-a-forum-o r-blog-post.php and prepare to be amazed.

                        • 9. Re: Changing manually applied Paragraph Rules
                          Trevorׅ Adobe Community Professional

                          Now my one does too

                           

                          // By Trevor http://forums.adobe.com/thread/1099425?tstart=0
                          #target indesign
                          #targetengine main
                          redraw = app.scriptPreferences.enableRedraw;
                          app.scriptPreferences.enableRedraw =0; // speeds up script
                          app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.FAST_ENTIRE_SCRIPT, "Adjust Paragraph Rules");
                          app.scriptPreferences.enableRedraw =redraw;
                          function main()
                          {
                              var doc = app.activeDocument;
                              var tr = doc.stories.everyItem().paragraphs.everyItem().getElements();
                              var tl=tr.length-1
                              while (tl--)
                              {
                                  if (tr[tl].ruleAboveLineWeight  < 1 && tr[tl].ruleAbove) tr[tl].ruleAboveLineWeight  = 1; // Change as required
                                  if (tr[tl].ruleBelowLineWeight  < 1 && tr[tl].ruleBelow) tr[tl].ruleBelowLineWeight  = 1; // Change as required
                              }
                          }
                          
                          • 10. Re: Changing manually applied Paragraph Rules
                            darrylrc1105 Level 1

                            Thankyou

                             

                            Its fantastic will save us hours and hours of production time

                             

                            Darryl