Skip to main content
erc02006
Participant
April 10, 2018
Answered

Create alert box that only pops up on the first document in a batch

  • April 10, 2018
  • 1 reply
  • 344 views

Hi,

I would like to create an alert box that will only come up on the first document in a batch. I have the pop-up as a Javascript that runs as part of a longer action that also includes preset Adobe actions (such as "Remove Hidden Data").

Right now I have something like this:

app.alert("Did you create a copy in a pre-cleaned folder?", 1);

The action then goes on to do a couple of other things from the pre-set actions in Adobe (removing hidden information, setting the initial view, and saving the document) before going on to the next document in the batch of files to be processed. However, when I include the javascript as part of my larger action, the alert box pops up with every document in the batch that is being processed. Is there a way to make it pop up only on the first document but not on subsequent documents?

Thank you!

This topic has been closed for replies.
Correct answer Thom Parker

The question you really want to ask is "How do you know which document is the first one in a batch process?"

Unfortunately Acrobat does not provide any way to know this. I've solved this issue in the past by writing the script to create a new document and save the doc object in global value, but only if that document is not already open. This file is then used to save the results of the processing. But main point is that is used to mark the beginning of the process. If the file does not exists, then a settings dialog is displayed for getting some info from the user. If it does exist, then processing just proceeds.

You'll find examples of this type of batch script here:

https://acrobatusers.com/actions-exchange

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
April 10, 2018

The question you really want to ask is "How do you know which document is the first one in a batch process?"

Unfortunately Acrobat does not provide any way to know this. I've solved this issue in the past by writing the script to create a new document and save the doc object in global value, but only if that document is not already open. This file is then used to save the results of the processing. But main point is that is used to mark the beginning of the process. If the file does not exists, then a settings dialog is displayed for getting some info from the user. If it does exist, then processing just proceeds.

You'll find examples of this type of batch script here:

https://acrobatusers.com/actions-exchange

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often