7 Replies Latest reply on Feb 20, 2013 7:43 AM by try67

    Strange behavior with spell object

    jesseg7681

      Here is a small example (pretty much the same as the example on http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/wwhelp/wwhimpl/js/html/wwhel p.htm?href=JavaScript_SectionPage.70.1.html&accessible=true for

      checkWord). The following bare minimum program adds a menu item to Acrobat under the Help menu.

       

      **QUESTION**

      If I comment out one line in the code (Noted as "THIS LINE" below), Acrobat *does not* create Squiggly lines under the spell misses. If I leave the line in, the script runs as expected. Is this behavior as expected? As far as I can tell it looks like a bug, but I was wondering if there is something I am missing about the spell object, is it always required to call `spell.available` before using the spell object? (I am using Acrobat Pro 9).

       

      app.addMenuItem( {

      cName: "CHECK",

      cUser: "CHECK",

      cParent: "Help",

      cExec: "checkfunc();",

      nPos: 0

      });

       

      checkfunc = function(){

                var numWords;

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

                {

                  var ckWord = " ";

                          numWords = this.getPageNumWords(i);

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

                          {

                                spell.available; // <---- THIS LINE

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

                                    if (ckWord != null)

                                    {

                                              this.addAnnot

                                              ({

                                               page: i,

                                               type: "Squiggly",

                                               quads:  this.getPageNthWordQuads(i,j),

                                               author: "Me"

                                              });

                                    }

       

                          }

       

                }

      }