Skip to main content
Known Participant
August 24, 2017
Question

How to refresh a global variable

  • August 24, 2017
  • 2 replies
  • 1759 views

Hi,

I have a batch labeling action wizard which stores the starting document # in a global variable as "global.dnum".  The default start value is 1 (e.g., document 1).  I noticed if the user does not completely close Adobe Acrobat after labeling a batch of documents and then starts the action wizard again to label the next batch of documents, the action wizard skips the first document and instead labels the 2nd document with document 1 instead of document 2.  My guess is this happens because the global variable needs to be reset.  How can I force a reset/refresh of global.dnum so the user can label a set of say 10 documents and then label another set of 15 different documents, etc. without having to close Adobe Acrobat to ensure the right starting document number of 1 for each batch of documents?

Using Acrobat Pro IX.

Thx.

Sue

This topic has been closed for replies.

2 replies

Joel Geraci
Community Expert
Community Expert
August 24, 2017

Add...

delete global['dnum'];

to the end of your batch.

try67
Community Expert
Community Expert
August 24, 2017

How would you know when the batch ends?

suemo22Author
Known Participant
August 25, 2017

Hi,

I tried adding delete global.[dNum] to the javascript portion of this action wizard as Joel suggested but it did not do clear the variable after the batch ended.  Instead it reset the global variable after each time it labeled a document so try67 was right. 

Note I don't really have a traditional loop in the code.  Instead, the label gets applied to the first open document and then the remaining hidden documents which were selected for the batch.  After no more hidden documents are found, then it stops labeling and therefore ends the batch.  This was my work around for not being able to have a loop in the code b/c the action wizard sequence makes it difficult to have one.

I need to be able to reset the global variable after the batch ends so any advise would be so appreciated.  Some thoughts I had were:

1) Is there a way to identify the last hidden document in the sequence?

2) Is there a way to force the closing of the entire Adobe Acrobat after (1) is identified?

Then I can create an if then statement to do (2) when (1) happens or delete global variable when (1) happens.

Thx.

Sue

try67
Community Expert
Community Expert
August 24, 2017

You can create a folder-level script that adds a new menu item which

deletes or resets the global variable, if it exists.

On Thu, Aug 24, 2017 at 5:28 PM, sargums46564804 <forums_noreply@adobe.com>