watchDirectory Help > Plugins > Automatically run .bat files
Automatically run .bat files - Using the wdAnnotate program
When you use the .bat file plugin, you may want to write information to the Task History from inside your script. The wdAnnotate program, installed inside the "plugins" subdirectory of watchDirectory, can be used for that. To make starting this program easier, the Environment Variable ANNOTATE is set to the complete path of this program.
Important: this program should NEVER be used when you have set the option Don't wait for .bat files to complete!!
Writing to the Task History
Writing to the task history database is very easy with this program. Inside your .bat file you can just enter a line like:
%ANNOTATE% info "Starting to convert file %WD_FILE%"
The above will write an "informational" message to the history database. As the message is written to the database "below" the current file system event, the inclusion of the %WD_FILE% variable inside the message is not strictly necessary.
The first parameter you pass to the wdAnnotate program is used to determine what kind of message should be written to the database. Depending on how you configured your task (see the Other tab) some messages may be ignored. Your choices for the kind of messages are:
Messages are only written to the database if you have the "write debug information" setting enabled here.
Used to write "normal" messages about the task. These messages are only written if you select "maximal" on the history tab of the watchDirectory Control Center (View -> Options -> History).
Used to write "warning" messages about the task. These messages are shown in inside the History viewer.
These messages are only written if you did NOT select "minimal" on the history tab of the watchDirectory Control Center (View -> Options -> History).
- error and fatal
Used to write "error" messages about the task. These messages are shown in inside the History viewer.
Writing an error message causes the task to ABORT!
If you don't want the messages to show under the current event, but with the messages of the current run, prefix the message type with an exclamation mark (!). For example:
%ANNOTATE% !info "Starting to convert file %WD_FILE%"