Call Actions (Sequences) from Another Actions
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
