2 Replies Latest reply on Apr 25, 2016 1:42 AM by Test Screen Name

    Adobe Acrobat 9 console keeps giving me undifined

    alexyhalaby Level 1

      Hello,

       

      I have been tasked with converting an excel sheet to PDF, everything went fine until I reached the count and no matter what I try I just receive either nothing or an error code saying undefined. If I call on a value with this.getField("REGHOUR1").value , I get a result, but when I do this:

      ----------------------------------------------

      var a = this.getField("REGHOUR1").value;

      return a;

      ----------------------------------------------

      or

      ----------------------------------------------

      var a = this.getField("REGHOUR1");

      return a.value;

      ----------------------------------------------

       

      or

      ----------------------------------------------

      function test ()

      {

      var a = this.getField("REGHOUR1");

      return a.value;

      }

      ----------------------------------------------

      I get nothing, so i tested out a simple code:

      ----------------------------------------------

      \\my code

      function test ()

      {

      for (var i = 0; i<5; i++)

      return i;

      }

      \\error message

       

       

      syntax error

      1:Console:Exec

      undefined

      ----------------------------------------------

      and I still scripts are not working, I tried looking for guides online and came across a few, and even by copying the same scripts for testing, still nothing happens or I get errors.

       

      has anyone encountered something like this, and if so, did you solve it?

        • 1. Re: Adobe Acrobat 9 console keeps giving me undifined
          try67 MVP & Adobe Community Professional

          You should read up a bit about core JS syntax. From your four examples, only the third one is correct, and even there it seems you're not actually calling the function, so it will not return anything.

          And when you see "undefined" after running some code all it means is it finished running without errors and without returning any values. It's not an error message.

          • 2. Re: Adobe Acrobat 9 console keeps giving me undifined
            Test Screen Name Most Valuable Participant

            More hints:

             

            When you see

            syntax error

            1:Console:Exec

            undefined

            The first line tells you there is an error.

            The second line tells you where the error is (that is, in what you typed)

            The third line is nothing to do with the error.

             

            A common problem, even if the code is correct, is to run only one line. To run all the lines first select all the lines, then press Enter. It's a strange and unusual thing, the console.