6 Replies Latest reply on May 23, 2015 1:46 PM by gkaiseril

    actions or batch sequence - global.FileCnt is undefined

    lorraine123

      I've tried the following example in the adobe acrobat docu (see code below). However, it never reaches "End Job Code" line. Upon logging, global.FileCnt has always been undefined. Why is that? Isn't it supposed to be populated by the total number of pdfs selected? Am I missing something?

       

      // Begin Job

      if (typeof global.counter == "undefined") {

          console.println("Begin Job Code");

          global.counter = 0;

          // insert beginJob code here

      }

      // Main Code to process each of the selected files

      try {

          global.counter++

              console.println("Processing File #" + global.counter);

          // insert batch code here.

      } catch (e) {

          console.println("Batch aborted on run #" + global.counter);

          delete global.counter; // so we can try again, and avoid End Job code

          event.rc = false; // abort batch

      }

      // End Job

      if (global.counter == global.FileCnt) {

          console.println("End Job Code");

          // insert endJob code here

          // may have to remove any global variables used in case user wants to run

          // another batch sequence using the same variables, for example...

          delete global.counter;

      }

       

      Thanks!