1 Reply Latest reply on Oct 30, 2012 9:07 AM by BarlaeDC

    Add Therometer

    designmon79

      Hi All,

       

      I have found the script which I needed but I want to add therometer/progress bar in this script.

       

      I have tried to add this code but fail. Can anyone please add this code in below script.

       

      Thanks,

      Mon

       

      //Begin Code

      /* A search dialogue that highlights the words you designate in the dialog box. */

       

      app.addMenuItem({ cName: "Find Highlighter", cParent: "Tools", nPos: 0, cExec: "highlighterFind()"});

       

      function highlighterFind()

      {

       

       

      var wordFind = app.response({

      cQuestion:"Enter the word you wish to search for",

      cTitle:"Quick Search"

      });

       

      if(wordFind != null)

      {

       

      search.query(wordFind, "ActiveDoc")

       

      var ckWord, numWords;

      for (var i = 0; i < this.numPages; i++ )

      {

      numWords = this.getPageNumWords(i);

      for (var j = 0; j < numWords; j++)

      {

       

       

      ckWord = ckWord = this.getPageNthWord(i,j);

       

      if (ckWord == wordFind) {

      /* then highlight it */

       

      this.addAnnot({

      page: i,

      strokeColor: color.yellow,

      type: "Highlight",

      quads: this.getPageNthWordQuads(i, j),

      author: "Acrobat JavaScript Highlighter",

      contents: wordFind.toString()

      });

      };

       

      };

       

      };

      };

      app.alert ("Acrobat is done highlighting the current document",3)

      };

       

      //End Code

        • 1. Re: Add Therometer
          BarlaeDC Level 4

          Hi,

           

          Here is the code modified, and this is taken straight from the documentation with very little changed - the documentation is here http://livedocs.adobe.com/acrobat_sdk/10/Acrobat10_HTMLHelp/JS_API_AcroJS.88.1211.html

           

          and the modified code is here, added lines in bold, (this has been tested in Acrobat X)

           

          app.addMenuItem({ cName: "Find Highlighter", cParent: "Tools", nPos: 0, cExec: "highlighterFind()"});

           

          function highlighterFind()

          {

              var wordFind = app.response({

              cQuestion:"Enter the word you wish to search for",

              cTitle:"Quick Search"

              });

           

              if(wordFind != null)

              {

                  var t = app.thermometer;

                  t.duration = this.numPages;

                  t.begin();

                  search.query(wordFind, "ActiveDoc")

                  var ckWord, numWords;

                  for (var i = 0; i < this.numPages; i++ )

                  {

                      t.value = i;

                      t.text = "Processing page " + (i + 1);

                      numWords = this.getPageNumWords(i);

                      for (var j = 0; j < numWords; j++)

                      {

                          ckWord = ckWord = this.getPageNthWord(i,j);

                          if (ckWord == wordFind)

                          {

                              /* then highlight it */

                              this.addAnnot({

                                  page: i,

                                  strokeColor: color.yellow,

                                  type: "Highlight",

                                  quads: this.getPageNthWordQuads(i, j),

                                  author: "Acrobat JavaScript Highlighter",

                                  contents: wordFind.toString()

                              });

                          };

                      };

                     if ( t.cancelled) break;

                  };

                  t.end();

              };

              app.alert ("Acrobat is done highlighting the current document",3)

          };

           

          Hope this helps

           

          Malcolm