Copy link to clipboard
Copied
As the title says, first I want to add a Suffix to all paragraph and character styles:
Heading 1 = Heading 1_p
bold = bold_p
Also if possible replace the space with a underscore:
Heading 1 = Heading_1_p
Chapter Heading 1 = Chapter_Heading 1_p
Not sure if this need one script or two?
Any help would be fantastic.
Cheers
Or use below code for replace all spaces with "_"
For Paragraph Styles:
myStyles=myDoc.paragraphStyles;
for (oneStyle=2;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].name= myStyles[oneStyle].name.replace (/ /g, "_") + "_p";
}
For Character Styles:
var mycStyleslen = myDoc.characterStyles.length;
for (a=1; a<mycStyleslen; a++)
{
myDoc.characterStyles.name = myDoc.characterStyles.name.replace (/ /g, "_") + "_p";
}
Shonky
Copy link to clipboard
Copied
For Paragraph Styles:
myStyles=myDoc.paragraphStyles;
for (oneStyle=2;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].name= myStyles[oneStyle].name + "_p";
}
For Character Styles:
var mycStyleslen = myDoc.characterStyles.length;
for (a=1; a<mycStyleslen; a++)
{
myDoc.characterStyles.name = myDoc.characterStyles.name + subfixcharastyle;
}
Shonky
Copy link to clipboard
Copied
For Paragraph Styles:
myStyles=myDoc.paragraphStyles;
for (oneStyle=2;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].name= myStyles[oneStyle].name + "_p";
}
For Character Styles:
var mycStyleslen = myDoc.characterStyles.length;
for (a=1; a<mycStyleslen; a++)
{
myDoc.characterStyles.name = myDoc.characterStyles.name + "_p";
}
Shonky
Copy link to clipboard
Copied
Thank you very much Shonkyin , I only just had time to make a coffee! super fast!!!
Just need to work out how to replace a space with a _ ?
Heading 1 = Heading_1_p
Chapter Heading 1 = Chapter_Heading 1_p
Copy link to clipboard
Copied
For Paragraph Styles:
myStyles=myDoc.paragraphStyles;
for (oneStyle=2;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].name= myStyles[oneStyle].name.replace (" ", "_") + "_p";
}
For Character Styles:
var mycStyleslen = myDoc.characterStyles.length;
for (a=1; a<mycStyleslen; a++)
{
myDoc.characterStyles.name = myDoc.characterStyles.name.replace (" ", "_") + "_p";
}
Shonky
Copy link to clipboard
Copied
Or use below code for replace all spaces with "_"
For Paragraph Styles:
myStyles=myDoc.paragraphStyles;
for (oneStyle=2;oneStyle<myStyles.length;oneStyle++)
{
myStyles[oneStyle].name= myStyles[oneStyle].name.replace (/ /g, "_") + "_p";
}
For Character Styles:
var mycStyleslen = myDoc.characterStyles.length;
for (a=1; a<mycStyleslen; a++)
{
myDoc.characterStyles.name = myDoc.characterStyles.name.replace (/ /g, "_") + "_p";
}
Shonky
Copy link to clipboard
Copied
Once again, thank you very much! Fantastic!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now