8 Replies Latest reply on Aug 16, 2016 5:09 AM by Obi-wan Kenobi

    How can i Remove Returns from a Certain Paragraph Style?

    cbishop01 Level 2

      I have a paragraph style (SafetyDATA) set and i all i need is to remove all the return from it.  How can i do this? 

       

      Thank you .. for any help

        • 1. Re: How can i Remove Returns from a Certain Paragraph Style?
          Obi-wan Kenobi Adobe Community Professional

          With Javascript?

          Do you want a space instead of the return?

          • 2. Re: How can i Remove Returns from a Certain Paragraph Style?
            cbishop01 Level 2

            Sorry.  Yes with Java Script and replace it with a space.  

            • 3. Re: How can i Remove Returns from a Certain Paragraph Style?
              Obi-wan Kenobi Adobe Community Professional

              Try:

               

              var myDoc = app.documents.item(0);
              app.findGrepPreferences = app.changeGrepPreferences = null;
              app.findGrepPreferences.findWhat = "\\r";
              app.findGrepPreferences.appliedParagraphStyle = "SafetyDATA";
              app.changeGrepPreferences.changeTo = " ";
              myDoc.changeGrep();
              
              1 person found this helpful
              • 4. Re: How can i Remove Returns from a Certain Paragraph Style?
                cbishop01 Level 2

                This works how can i add it to my script?  I'm adding it to my Find Replace Script Here's how its setup now. Here's my find replace as of right now.  Is it possible to addit in there?  if so how ?  Thnak you

                   function cb1CallBack(target) {    
                  
                   var findProps = {    
                         findWhat:"/*\\s{2, }*/",},    
                 //     changeProps = { changeTo:" ",};    
                   //     grep (target,  findProps, changeProps );  
                         findProps = {findWhat:" <CR> ",},    
                            changeProps = { changeTo:"<CR>",};    
                        grep (target,  findProps, changeProps );
                         findProps = {findWhat:"<CR>",},    
                            changeProps = { changeTo:"\r",};    
                        grep (target,  findProps, changeProps );
                         findProps = {findWhat:" :",}   
                            changeProps = { changeTo:":",}
                        RTXT(target, findProps, changeProps);
                         findProps = {findWhat:" .",}   
                              changeProps = { changeTo:".",}
                        RTXT(target, findProps, changeProps);
                         findProps = {findWhat:"  ",}   
                              changeProps = { changeTo:" ",}
                        RTXT(target, findProps, changeProps); 
                         findProps = {findWhat:"^p^p",}   
                              changeProps = { changeTo:"^p",}
                        RTXT(target, findProps, changeProps); 
                         findProps = {findWhat:"DISE—ADO",}   
                              changeProps = { changeTo:"DISEÑADO",}
                        RTXT(target, findProps, changeProps);
                        findProps = {findWhat:"DA—O",}   
                              changeProps = { changeTo:"DAÑO",}
                        RTXT(target, findProps, changeProps); 
                        
                        // Right here is where i would like to place the Remove Return for Paragraph Style.
                       findWhat:"\\r";    
                           changeTo:" ";    
                        grepR (target,  findWhat, changeTo );  
                            
                }    
                // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GREP SEARCH  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<    
                    w.close(true);
                    function grep(target, findProps, changeProps) {    
                        app.findGrepPreferences = app.changeGrepPreferences = null;    
                        app.findGrepPreferences.properties = findProps;    
                        app.changeGrepPreferences.properties = changeProps;    
                        target.changeGrep();    
                 }  
                  
                    function grepR(target, findWhat, changeTo){
                        app.findGrepPreferences = app.changeGrepPreferences = null;  
                    app.findGrepPreferences.findWhat = "\\r";  
                    app.findGrepPreferences.appliedParagraphStyle = "SPANISH WARNING STATEMENT";  
                    app.changeGrepPreferences.changeTo = " ";  
                    myDoc.changeGrep();  
                
                        }
                
                // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEXT SEARCH  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<    
                    function RTXT(target, findProps, changeProps){      
                         app.findChangeTextOptions.caseSensitive = true;      
                         app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;      
                         app.findTextPreferences.properties = findProps;      
                         app.changeTextPreferences.properties = changeProps;   
                         target.changeText();      
                  } 
                 }
                
                
                
                
                // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PROGRESS BAR <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
                
                • 5. Re: How can i Remove Returns from a Certain Paragraph Style?
                  tpk1982 Level 4

                  try this

                   

                  function cb1CallBack(target) {     
                     
                    var findProps = {     
                          findWhat:"/*\\s{2, }*/",},     
                  //    changeProps = { changeTo:" ",};     
                    //    grep (target,  findProps, changeProps );   
                          findProps = {findWhat:" <CR> ",},     
                              changeProps = { changeTo:"<CR>",};     
                          grep (target,  findProps, changeProps ); 
                          findProps = {findWhat:"<CR>",},     
                              changeProps = { changeTo:"\r",};     
                          grep (target,  findProps, changeProps ); 
                          findProps = {findWhat:" :",}   
                              changeProps = { changeTo:":",} 
                          RTXT(target, findProps, changeProps); 
                          findProps = {findWhat:" .",}   
                                changeProps = { changeTo:".",} 
                          RTXT(target, findProps, changeProps); 
                          findProps = {findWhat:"  ",}   
                                changeProps = { changeTo:" ",} 
                          RTXT(target, findProps, changeProps); 
                          findProps = {findWhat:"^p^p",}   
                                changeProps = { changeTo:"^p",} 
                          RTXT(target, findProps, changeProps); 
                          findProps = {findWhat:"DISE—ADO",}   
                                changeProps = { changeTo:"DISEÑADO",} 
                          RTXT(target, findProps, changeProps); 
                          findProps = {findWhat:"DA—O",}   
                                changeProps = { changeTo:"DAÑO",} 
                          RTXT(target, findProps, changeProps); 
                           
                          // Right here is where i would like to place the Remove Return for Paragraph Style. 
                        findWhat:"\\r";     
                            changeTo:" ";     
                          grepR (target,  findWhat, changeTo );   
                          RTXT1(target,  findWhat, changeTo)
                               
                  }     
                  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> GREP SEARCH  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
                      w.close(true); 
                      function grep(target, findProps, changeProps) {     
                          app.findGrepPreferences = app.changeGrepPreferences = null;     
                          app.findGrepPreferences.properties = findProps;     
                          app.changeGrepPreferences.properties = changeProps;     
                          target.changeGrep();     
                  }   
                     
                      function grepR(target, findWhat, changeTo){ 
                          app.findGrepPreferences = app.changeGrepPreferences = null;   
                      app.findGrepPreferences.findWhat = "\\r";   
                      app.findGrepPreferences.appliedParagraphStyle = "SPANISH WARNING STATEMENT";   
                      app.changeGrepPreferences.changeTo = " ";   
                      myDoc.changeGrep();   
                  
                          } 
                  
                  // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> TEXT SEARCH  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     
                      function RTXT(target, findProps, changeProps){       
                          app.findChangeTextOptions.caseSensitive = true;       
                          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;       
                          app.findTextPreferences.properties = findProps;       
                          app.changeTextPreferences.properties = changeProps;   
                          target.changeText();       
                    } 
                  } 
                  
                  
                  function RTXT1(target, findProps, changeProps){   
                  app.findGrepPreferences = app.changeGrepPreferences = null; 
                  app.findGrepPreferences.findWhat = "\\r"; 
                  app.findGrepPreferences.appliedParagraphStyle = "SafetyDATA"; 
                  app.changeGrepPreferences.changeTo = " "; 
                  target.changeGrep();
                  }
                  
                  • 6. Re: How can i Remove Returns from a Certain Paragraph Style?
                    cbishop01 Level 2

                    Thank you for your reply.  I've tried this and still not working.  And i made a typo on my original Code. the grepR Function should have had the SafetyData Paragraph style.  That one does not work either.  in the RTXT1 i also Changed find/changeProps to find/changeWhat to see if that would do it and it did not.  I also placed this in its own Check box to see if One of the other searches were Conflicting with it and same results.

                    • 7. Re: How can i Remove Returns from a Certain Paragraph Style?
                      cbishop01 Level 2

                      THey need to add a 2nd correct answer button.  Yours was correct as well. I only had to change the \\r to \r or \\s then it would work.  Not sure why \\r didn't work.   Thanks for your help