Skip to main content
Inspiring
July 5, 2018
Question

How do you loop an action in Acrobat 11 Pro

  • July 5, 2018
  • 2 replies
  • 7811 views

Hi,

I have an action which prints a batch of pdf files. It is important that the files are printed in a particular sequence. This all works fine. However I now want to print multiple copies of the entire batch keeping the same sequence per batch.

I have tried editing the .sequ file by copying the entire batch several times. However, the additional batches are just ignored. It seems the action recognises that it has already printed the file and does not repeat it for duplicates (Scenario A).

I have found a workaround solution to this by creating multiple copies of the same folder with the same files. Now when I edit the .sequ file by copying the entire batch several times but referring to the different folders, there is no problem (Scenario B).

Examples:

Scenario A - This will only print one copy of Doc 1, Doc 2 and Doc 3 in sequence:

          <Sources>

                    <File path="/C/Folder/Doc 1.pdf"/>

                    <File path="/C/Folder/Doc 2.pdf"/>

                    <File path="/C/Folder/Doc 3.pdf"/>

                    <File path="/C/Folder/Doc 1.pdf"/>

                    <File path="/C/Folder/Doc 2.pdf"/>

                    <File path="/C/Folder/Doc 3.pdf"/>

                    <File path="/C/Folder/Doc 1.pdf"/>

                    <File path="/C/Folder/Doc 2.pdf"/>

                    <File path="/C/Folder/Doc 3.pdf"/>

                    </Sources>

          <Group label="Untitled">

                    <Command name="Print" pauseBefore="false" promptUser="false"/>

          </Group>

Scenario B - This will print three copies of Doc 1, Doc 2 and Doc 3 in sequence:

          <Sources>

                    <File path="/C/Folder/Doc 1.pdf"/>

                    <File path="/C/Folder/Doc 2.pdf"/>

                    <File path="/C/Folder/Doc 3.pdf"/>

                    <File path="/C/Folder - Copy (1)/Doc 1.pdf"/>

                    <File path="/C/Folder - Copy (1)/Doc 2.pdf"/>

                    <File path="/C/Folder - Copy (1)/Doc 3.pdf"/>

                    <File path="/C/Folder - Copy (2)/Doc 1.pdf"/>

                    <File path="/C/Folder - Copy (2)/Doc 2.pdf"/>

                    <File path="/C/Folder - Copy (2)/Doc 3.pdf"/>

                    </Sources>

          <Group label="Untitled">

                    <Command name="Print" pauseBefore="false" promptUser="false"/>

          </Group>

My question is:

Is there an easier way to do Scenario B? Is it possible to just loop Scenario A the number times required? If so, how?

Any help would be appreciated. Thanks!

This topic has been closed for replies.

2 replies

try67
Community Expert
July 8, 2018

If the file-paths are fixed and known in advance then this can be done with a script, where you would hard-code the paths of the files and then print them in order, how many times you'd like.

Inspiring
July 8, 2018

Thanks for your reply.

Yes the file-paths are fixed. Can you please give me an idea of how to go about writing a script to do this. I have never written a script in Acrobat. I'm more familiar with writing macros in Word and Excel. If you could give me something to start off with that would be great.

try67
Community Expert
July 8, 2018

Thanks!

If I understand your script correctly, this will print each document 3 times. This isn't quite what I had in mind. I need to print each file once in a particular order, then repeat the whole batch n number of times. Each document is stapled as it is printed. How can I use your code as a repeating subroutine printing each document once, which is called by another subroutine and passing the document path reference as a parameter?


The example above prints a single document 3 times. It can be converted to a more generic function, like this:

function printFileMultipleTimes(filePath, numCopies) {

    var doc = app.openDoc(filePath);

    if (doc!=null) {

        var pp = doc.getPrintParams();

        pp.NumCopies = numCopies;

        doc.print(pp);

        doc.closeDoc(true);

    }

}

You can then use it like this, for example:

printFileMultipleTimes("/C/Folder/Doc 1.pdf", 1);

printFileMultipleTimes("/C/Folder/Doc 2.pdf", 1);

printFileMultipleTimes("/C/Folder/Doc 3.pdf", 1);

printFileMultipleTimes("/C/Folder/Doc 1.pdf", 1);

printFileMultipleTimes("/C/Folder/Doc 2.pdf", 1);

printFileMultipleTimes("/C/Folder/Doc 3.pdf", 1);

This will print all three files, one after another, two times (one copy each time).

Brainiac
July 5, 2018

You could consider combining the files to print into one, then the order of printing becomes unimportant. Everything MIGHT get simpler.

Inspiring
July 5, 2018

Sorry, I should have added that each document is stapled separately when printed. So I can't just combine the documents into one.