3 Replies Latest reply on Dec 10, 2014 2:32 PM by jaredmstone

    script to duplicate Basic Paragraph style, then change character point size

    jaredmstone

      I'm looking to create a script that will create a cascade of paragraph styles based on the [Basic Paragraph] style settings. My goal is for each new paragraph style's character point size to be a percentage of the original [Basic Paragraph]'s. So if [Basic Paragraph] is 100% (character point size 10pt), the script would create a paragraph style named '120%' that has a character point size of 12pt. Then 133%, 140%, so on and on. I modified a script found on this forum to generate those new styles, but I don't know how to create them to be basedOn the [Basic Paragraph]. Any help would be very much appreciated, thanks in advance.

       

      current script:

       

      var doc = app.activeDocument,  

          pstyle = ["100%", "120%", "133%" ];  

          

      for(var i =0;i<pstyle.length;i++)  

      {  

              if(pstyle[i] == "100%") 

              { 

                  doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10});              

                  } 

              else if(pstyle[i] == "120%") 

              { 

                  doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.2})              

                  }

              else if(pstyle[i] == "133%") 

              { 

                  doc.paragraphStyles.add({name:pstyle[i], appliedFont:"Stag", pointSize:10*1.33333})              

                  }

          }