Skip to main content
Inspiring
December 13, 2018
Question

end of batch file

  • December 13, 2018
  • 2 replies
  • 449 views

From the DC SDK Documentation to find the end of a batch file you have to use the PDF count:

if (global.counter == global.FileCnt) { console.println("End of Job...");

delete global.counter;

delete global.FileCnt; }

This relies on the user to first run the global.FileCnt Action than run the main batch file for doc processing (which cnts the global.counter).

How can I find the end of a batch file if all I had was one Batch file? 

The other method is just not intuitive. 

This topic has been closed for replies.

2 replies

Thom Parker
Community Expert
Community Expert
December 14, 2018

I've handled this differently. In fact, if you go to the old AcrobatUsers.com Actions Exchange you can see how I solved this issue with several of the Actions there.

https://acrobatusers.com/actions-exchange

Basically I decided there is no need to detect when the batch ends. Instead, the batch script creates a summary document. It is this document that determines all batch (file) dependent actions. For example, if the summary document is not open when the script runs, then this is the first file in the batch, so the script creates the summary file. The summary file contains a list of all the files and the order in which they were processed, so you can keep track of any order dependent parameters, like file name numbering, or even page numbering, or parameters that were setup for the run. Of course the summary doesn't close when the batch process ends, so the user can choose to run the process again on another set of files and then they are included in the same summary, as if they were part of the same processing run. The run ends when the user closes the summary document, which can call a cleanup script. Another property of this technique is that if the user opens an old summary document, new runs can then be included in it.

I think this is a cleaner technique than requiring the user to run a counting process first. And it provides additional useful information such as the list of processed files. I also use it to save processing parameters, and the status of each processed file.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Legend
December 13, 2018

Not intuitive but a clever way to do something otherwise impossible. Just run multiple batches.