In case you want to try this example on a larger number files you can modify the create_documents.vbs script and run it. This script will create a number of input files for testing the functionality and robustness of the example.
There are other ways to determine when a print job is finished. In this example we wait until the runonce settings file is removed by the printer. Alternatively, you can use the RunOnSuccess, RunOnError, and AfterPrintProgram settings to hook into the printing process. Waiting for the output of the print job is not very robust since there will be no output in case of an error.