Search This Blog


Thursday, 20 October 2011

After printing the PDF, I want to...

Some of the WatchDirectory plugins are actually small batch file scripts (.bat or .cmd). Those scripts are typically called by WatchDirectory when new files are detected.

For example, the "Print PDF using FoxIt Reader" plugin is a .bat script that calls Foxit to print the pdf.

Some customers want to have a bit of extra functionality after printing the PDF, for example Delete, Copy or Move the pdf. Here is how you do it, should be easy enough if you know a little bit of batch scripting.

Locate the batch Script to change

In this blogpost I will assume your WatchDirectory task is called PrintPDF, change the directory name below accordingly.

  • Make sure the task (PrintPDF) is not running while you make changes to its script
  • Inside the WatchDirectory Control Center select the menu "Tools -> Explore Task Directory"
    (this opens Windows Explorer inside the directory where WatchDirectory stores all its settings)
  • Navigate one directory "deeper" into the subdirectory with the name of your task (PrintPDF)
  • Inside this directory you will find a file called wd.bat, this is the script started by WatchDirectory

Make the changes

Open the file wd.bat in a text editor (notepad) and scroll to the bottom where you will find the following 2 lines

%ANNOTATE% Info done

Any changes you want to make after the file has printed should be just before the "%ANNOTATE%" line.

Delete the PDF after printing

Insert the following line


Move the PDF after printing

Insert the following line

MOVE "%WD_FILE%" "C:\Some Other Directory"

Print the PDF twice

Just repeat the FOXCMD line, like this

%ANNOTATE% Info done

1 comment:

Cokers said...

We use WatchDirectory to print some PDF files to our document archiving system. Some of these files are blank therefore they have a very small file size. We use commands in the .bat file to filter the small files out.


COPY "%WD_FILE%" "C:\SmallFiles"