Skip to main content
Inspiring
July 31, 2017
Question

Call Actions (Sequences) from Another Actions

  • July 31, 2017
  • 1 reply
  • 1741 views

Hi,

     I need to call one action from another action. How can I call action from javascript code?? For eg.,

     The following code is a general outline of how you can insert Begin Job and End Job code: it uses global.counter to detect the beginning of the job and uses another global variable global.FileCnt, which is set earlier by another batch sequence that counts the number of files to be processed, see Count PDF files, to detect the end of the job.

ACTION 1:  Count PDF Files Sequence Code

/* Count PDF files */

if ( typeof global.FileCnt == "undefined" ) global.FileCnt = 0;

global.FileCnt++

ACTION 2 : Begin and End job code for batch process

// 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; // 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;

}

I got the above code when I searching.  In that they have said need to call Count PDF Files action before call Begin and End job Action.  But I don't how to call.  Can anyone help to how to merge these two sequences??

- Sudha K

This topic has been closed for replies.

1 reply

Bernd Alheit
Community Expert
Community Expert
July 31, 2017

Put both sequences in one sequence.

Sudha_KAuthor
Inspiring
August 1, 2017

Hi,

     I need to call the 2nd one after completing of the first one. Because the first one returns the no.of files.  Based on that the 2nd will run.

    Is there is any command to execute sequence one after another in Acrobat Javascript??

Bernd Alheit
Community Expert
Community Expert
August 1, 2017

Not possible.