Skip navigation
Currently Being Moderated

It is possible to rename (many) styles with a consecutive number?

Feb 15, 2013 1:33 AM

It is possible to apply a number to the styles and replace their actual names in a publication?


For example,


Body text [to:]     1

Quotes [to:]     2

Footnotes [to:]     3

TitleA [to:]     4




Thank you.

  • Currently Being Moderated
    Feb 15, 2013 2:30 AM   in reply to camilo umaña

    Renaming a style in the Paragraph panel will automatically rename it everywhere it's used.

    Using Javascript, all it takes is this:


    styles = app.activeDocument.allParagraphStyles;
    for (i=2; i<styles.length; i++)
    styles[i].name = String(i-1);
    Mark as:
  • Currently Being Moderated
    Feb 15, 2013 6:38 AM   in reply to camilo umaña

    > Just for the record: this may be scripted with a predefined list instead of numbers?


    Sure. If you provide a list of names, the script can assign the first name to the first style, etc. Add something like this (untested) at the top


    var names = ["jw", "marc", "loic", "peter", "peter 2", "peter 3"];


    and then use


    styles[i].name = names[i-2];


    You should take care the list of names is long enough to re-name *all* of your styles, or else the script will stop with an error.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points