3 Replies Latest reply on Jan 15, 2018 5:57 PM by Jo_2013

    Create one report from multiple pdf files

    Jo_2013 Level 1

      I have an action script to create a report listing the document file names from multiple pdf files.

      The script is creating multiple reports for each pdf file, instead of appending each document file name in the single report.

      If anyone can help to amend the script so that a single report is created will be most appreciated


      // Begin job

      var docfile = this.documentFileName;

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


      global.counter = 0;


      // Main code to process each of the selected files

      try {


      global.report = new Report()

      global.report.writeText("Report on File \#"+global.counter + docfile + "\r\n");

      global.report.open("job report")

      } catch(e) {

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

      delete global.counter; // 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

      // Remove any global variables used in case user wants to run

      // another batch sequence using the same variables

      delete global.counter;


        • 1. Re: Create one report from multiple pdf files
          Bernd Alheit Adobe Community Professional & MVP

          Try this:

          if (global.counter == 1) global.report = new Report();

          1 person found this helpful
          • 2. Re: Create one report from multiple pdf files
            Thom Parker Adobe Community Professional

            This is what I used for most of the Action scripts I created on this page:


            Rick Borstein hired me to create them, so look at all the ones with his name.





                global.oBkmkSumDoc = new report();

            .. Build report doc.



            Usually there is also a custom dialog that is displayed at the same time the new report is created. The important bit here is that accessing the properties of a dead object will throw an exception. So if the report file does not exist, it will be created and the initial setup params dialog will be displayed. If it does exist, then anything new that happens will be added to it.


            Keeping parameters like a report count are unreliable. There is no way to know if something outside your Action is affecting parameters like a global.counter, so it is unreliable. But a pointer to the report document is very direct and reliable. It either exists or is doesn't.


            In my setup the report document is completely built and then the dynamic data from the batch process is collected into form fields.  I think it's a bad idea to leave a report object hanging between batch operations. There is literally no way to know when the Batch process is finished, unless you require the use to hit some kind of finish button.

            1 person found this helpful
            • 3. Re: Create one report from multiple pdf files
              Jo_2013 Level 1

              Thank you very much Thom.


              Downloaded the Create Comment Summary script from Actions exchange.


              I have adapted the part of this action that creates a new document and lists all document file names from multiple pdf files.


              This is a very impressive action with a detailed amount of scripting, well done.