Rename all Paragraph styles with specific suffix
- This topic has 3 replies, 2 voices, and was last updated 7 years, 3 months ago by .
- You must be logged in to reply to this topic.
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Rename all Paragraph styles with specific suffix
Learn / Forums / InDesign Add-ons (Scripts, Scripting, and Plug-ins) / Rename all Paragraph styles with specific suffix
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.
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.
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.
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.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies allows us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
To provide the best experiences, we and our partners use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us and our partners to process personal data such as browsing behavior or unique IDs on this site and show (non-) personalized ads. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Click below to consent to the above or make granular choices. Your choices will be applied to this site only. You can change your settings at any time, including withdrawing your consent, by using the toggles on the Cookie Policy, or by clicking on the manage consent button at the bottom of the screen.
You have to be logged in to save.
Not a member? Join Today - it's FREE!