6 Replies Latest reply on Nov 12, 2009 9:19 AM by dhishok

    replace styles script needed

    rpollack-2 Level 1

      Does anyone know of a script that will allow me to replace one paragraph style with another. I would like a something that would list all the paragraph styles in one list box and have another list box for "replace with..."

       

      Paragraph Styles
      Change to Style
      BODY 10/12BODY 12/15
      BODY 12/15
      MY STYLE 10/12 ITALIC W/GREPMY STYLE 10/12 BOLD W/GREP
      MY STYLE 10/12 BOLD W/GREP

       

      Something like this

       

      Thanks in advance

       

      RPP

        • 1. Re: replace styles script needed
          AdobeScripts Level 3

          hi

           

          for PC or for Mac ?

           

          robin

           

          www.adobescripts.co.uk

          • 2. Re: replace styles script needed
            rpollack-2 Level 1

            maybe I don't load these scripts correctly, however none of the "exe" scripts that I place in the scripts panel folder in my InDesign CS4 ever work.

             

            Is there some way to get these scripts as javascript and not exe files?

             

            Also, I went to the link and looked at all the scripts there. I did not see one that does what I need. The "replace style" script suggested will not work, as (if I have read the description correctly) it will replace a "used" style with an "unused" style. What if I want to replace one used style with another style already used?

             

            Thanks for you suggestions.

             

            RPP

            • 3. Re: replace styles script needed
              Kasyan Servetsky Level 5

              This is very basic — it doesn't check if any document is open, or the styles exist, etc.

               

              var myDoc = app.activeDocument;
              app.findTextPreferences = app.changeTextPreferences = null;

               

              app.findTextPreferences.appliedParagraphStyle = "BODY 10/12";
              app.changeTextPreferences.appliedParagraphStyle = "BODY 12/15";
              myDoc.changeText();
              app.findTextPreferences.appliedParagraphStyle = "MY STYLE 10/12 ITALIC W/GREP";
              app.changeTextPreferences.appliedParagraphStyle = "MY STYLE 10/12 BOLD W/GREP";
              myDoc.changeText();
              // and so on, or if you have a lot of styles to change, create 2 arrays:

              // with find-change names and loop thru them in a for loop
              app.findTextPreferences = app.changeTextPreferences = null;

               

              Hope it helps.

               

              Kasyan

              • 4. Re: replace styles script needed
                AdobeScripts Level 3

                hi

                 

                all my scripts are created for PC platform only - they are compiled VisualBasic scripts - not VBScripts

                 

                if you are reffering to "Replace Styles" script - it was created for old ID's - before Adobe added option to replace styles during import DOC/RTF (there is error on screen - on right there is list of all char/para styles - not only "unused")

                 

                the closest script for your needs would be SerialReplace (http://www.adobescripts.com/search.php?query=serialreplace&action=results)

                 

                robin

                 

                www.adobescripts.co.uk

                • 5. Re: replace styles script needed
                  dhishok Level 1

                  Here is the method Find/Change to replace one style to another...

                   

                  myFStyles=["BODY 10/12", "MY STYLE 10/12 ITALIC W/GREP"]; //add some more styles in find array;

                  myRStyles=["BODY 12/15", "MY STYLE 10/12 BOLD W/GREP"]; //add some more styles in change array;

                   

                  var j=0;

                  for (i=0; i<myFStyles.length; i++){
                          app.findTextPreferences=app.changeTextPreferences=null;
                          app.findTextPreferences.appliedParagraphStyle=myFStyles[i];
                          app.changeTextPreferences.appliedParagraphStyle=myRStyles[j];
                          app.documents.item(0).changeText();
                          j++;
                  }

                   

                  alert ("DONE!");

                   

                   

                  I hope this will help you.

                   

                  Thanks & Regards

                  Thiyagu

                  • 6. Re: replace styles script needed
                    rpollack-2 Level 1

                    thanks, I will look this over in the next couple of days.

                     

                    RPP