Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

add a Suffix to all paragraph and character styles +

New Here ,
Jan 25, 2010 Jan 25, 2010

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

TOPICS
Scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jan 25, 2010 Jan 25, 2010

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

Translate
Engaged ,
Jan 25, 2010 Jan 25, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 25, 2010 Jan 25, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2010 Jan 25, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 25, 2010 Jan 25, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 25, 2010 Jan 25, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 25, 2010 Jan 25, 2010
LATEST

Once again, thank you very much! Fantastic!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines