1 Reply Latest reply on Jan 17, 2014 4:01 AM by Peter Kahrel

    replace asterisks with note figures

    sdams

      Hi

       

      I have a book project in which I need to replace all the asterisks in the text with a superscript figure (fisrt asterisk = superscript figure 1, second asterisk = superscript figure 2, etc.).

      At the end of the text there is a list of endnotes in which I need to do the same, only all the 'xxx' combinations need to become figures.

       

      Is there a way to do this with a script or a smart find/change?

       

      Thanx

      Fons

        • 1. Re: replace asterisks with note figures
          Peter Kahrel Adobe Community Professional & MVP

          Here you go:

           

          app.findGrepPreferences = null;
          
          doNumbers ("\\*");
          doNumbers ("^xxx");
          
          function doNumbers (f) {
              app.findGrepPreferences.findWhat = f;
              var found = app.documents[0].findGrep();
              for (var i = found.length-1; i >= 0; i--) {
                  found[i].contents = String(i+1);
              }
          }
          

           

          Peter