Rename all Paragraph styles with specific suffix

Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Rename all Paragraph styles with specific suffix

Viewing 3 reply threads
  • Author
    Posts
    • #91254

      I need a script to rename the styles.
      example: i have a style named
      body text 60, Bold 6055, Heading, Title
      I need these to get changed to
      body text 70, Bold 7055, Heading 70, Title 70.
      Can someone please help me to solve this.

    • #91255
      Ari Singer
      Member

      This can easily be done. But please provide me with the exact names of the paragraph styles (including the correct capitalization and spaces). And then its respective names to be changed to.

    • #91256
      Ari Singer
      Member

      The following simple script assumes that all the styles are paragraph styles and that it is spelled correctly.

      var allParaStyles = app.activeDocument.allParagraphStyles;
      
      changeName("body text 60", "body text 70");
      changeName("Bold 6055", "Bold 7055");
      changeName("Heading", "Heading 70");
      changeName("Title", "Title 70");
      
      function changeName(oldName, newName) {
      	for (var i = 2; i < allParaStyles.length; i++) {
      		var curStyle = allParaStyles[i];
      		var curName = curStyle.name;
      		if (curName == oldName) {
      			curStyle.name = newName;
      			break;
      			}
      		}
      	}
      

      You can easily change the style names or add more.

    • #91259

      Body 60, Body Bold 60, Body Bold Italic 60, Body Italic 60 these 4 are common in all the work remaining styles will get changed.

      When I replace 6 with 7 only the first 4 styles were getting changed to 70. Then
      I tried by adding 70 at the end of styles which added 70 even for body style and came as body 70 70.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
>