3 Replies Latest reply on Jun 10, 2011 6:45 AM by RichardM0701

    Script to Change Paragraph Numbering

    RichardM0701 Level 1




      I am really new to scripting (please don't hurt yourself laughing at my code below )  and need some help!






      The issue: The documents I author go through a translation process which takes the InDesign XML data and exports my text into a web browser tool so it can be translated. After it has been translated, the text is placed back into my document with the formatting and paragraph styles that it had when I exported it. That created a problem with Figure and Table captions as those paragraph styles have "Figure" and "Table" hardcoded into the paragraph style.



      Possible Solution: On page one of each document that is generated, I list the language of that document (for example "Russian"). I think I need to write a script that goes looks at the first page and if it has a language listed (in this case "Russian") then it replaces the paragraph numbering text with a defined text ("Рисуноk" is "Figure" in Russian).



      if ((app.documents.length != 0) && (app.selection.length != 0)) {
        myDoc = app.activeDocument;
        myStyles = myDoc.paragraphStyles;
        myStringList = myStyles.everyItem().name;


      // What im trying to do below: If page 1 contains text “Russian” then Change the “Figure Title” paragraph numbering style to “Рисунок ^#.” I am missing the page 1 text find function.



      var myPara = appliedParagraphfstyle;
      myPara.numberingStartAt: Рисунок ^#.



      I’m so lost!!!! Help! Screenshots below to show what im trying to achive. Thank you so much!


      Region Capture2.pngRegion Capture3.png

      Window Capture1.png

      Region Capture4.pngRegion Capture5.pngRegion Capture8.png