4 Replies Latest reply on Feb 28, 2014 12:23 PM by subieguy2

    TypeError: Invalid argument type

    subieguy2 Level 1

      I am not a programmer. I get by....but I am having an issue with a script I am running. The script runs and does exactly what I want it to do with the exception of the following error comes up in the javascript debugger window:

       

      TypeError: Invalid argument type.

      Doc.getPageNthWord:32:Field CONN Button Maker:Mouse Up

      ===> Parameter nPage.

       

       

      Here is the code that I currently have....could anyone tell me why I am getting the error I am?....and how to correct it?

       

      // prompt user to input the last number of the buttons needed

      var volNumQ = app.response ({cQuestion:"What volume are these CONNS for?", cTitle: "mv Button Generator", cDefault: "1"});

       

      // prompt user to input the last number of the buttons needed

      var machineViewNum = app.response ({cQuestion:"What machine view are you on", cTitle: "mv Button Generator", cDefault: "1"});

       

      var vnq = parseInt(volNumQ);

       

      // cast the user input as an int to pass to array...add 1 to compensate for array starting with zero

      var mvn = parseInt(machineViewNum);

       

      var mvData = [];

      var page = pageNum;

      var mvNumWords = this.getPageNumWords();

       

      for(var mv=0; mv<mvNumWords; mv++)

                {

                mvData[mv] = this.getPageNthWord(page, mv);

                }

       

      // Array to find all items on the page

       

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

      {

       

      for (var x = 0; x < calloutArray.length; x++) {

                for (var y = 0; y < mvData.length; y++) {

                mvData[y] = this.getPageNthWord(page, y);

                if (calloutArray[x] == mvData[y]) {

                //console.println("! MATCH ! - calloutArray["+ x + "] " + calloutArray[x] + " mvData[" + y + "] " + mvData[y]);

                var q = this.getPageNthWordQuads(page, y);

                m = (new Matrix2D).fromRotated(this,page);

                mInv = m.invert()

                r = mInv.transform(q)

                r=r.toString()

                r = r.split(",");

                var l = this.addField(('0000' + calloutArray[x]).substr(-4) + " cv" + vnq + " v" + ('00' + mvn).substr(-2), "button", page, [r[4], r[5], r[2], r[3]]);

                l.setAction("MouseUp", "this.gotoNamedDest('" + gridArray[x] + "');");

                l.userName = "Schematic Location";

                //skipCoords+=1;

                }

                }

      }

      page++;

      mvn++;

      }

       

      Any help would be greatly appreciated!

       

      Windows 7 64bit, Acrobat 8.0 Pro