How to Debug a Filter Script Video Tutorial Transcript
Welcome to the video tutorial on how to debug a filter script. In this tutorial, we’ll be going over how to place your filter script in debug mode, so you can determine precisely what your filter script is doing, and potentially modify its behavior.
The first step in placing the filter in debug mode is to set the Debug tag to True. To do that, open the XML file for your script and set this tag:
Next, you’ll need to rename the batch file you’re using, in order to put it into ‘verbose’ mode. To do so, browse to the filter’s directory.
If you're using preproc.bat, rename it to preprocv.bat
The GetASCII interface will check for the existence of preproc.bat and preprocv.bat before processing data in the folder. If preproc.bat or preprocv.bat exist, GetASCII will run whichever is present (and thereby execute the filter script) before reading data from the folder. This allows you to run your data through a filter script before processing it in to outbound messages.
If you're using pstproc.bat, rename it to pstprocv.bat
When using the FILE protocol output method, the Connectors will check for the existence of pstproc.bat or pstprocv.bat after writing the file(s). If pstproc.bat or pstprocv.bat exist, the Connectors will run whichever is present (and thereby execute the filter script) after the file is written. This allows you to pass the data through a filter script after a file is written, post-processing it.
Just to note, the “v” in the file name stands for Verbose. You're effectively putting the script in to a mode that will display far more information than it otherwise would.
Setting Debug to True and renaming the batch file appropriately puts the script in to debugging mode.
The final step is to be sure that PageGate is running as an application, rather than a system service. This allows PageGate’s processes to interact with the Windows desktop and display necessary debugging information. If PageGate is running as a service then nothing can be displayed.
To switch PageGate’s run style, right click on the shortcut for PG Admin and select ‘Run as Administrator’. Then go to Program – Settings and you should see the ‘Run PageGate as’ section. Select Application, then click Apply.
When in debugging mode, the script will display a command window that shows the result of every operation of your filter script. The command window will wait for a keypress after displaying all the debug info, so you can review the results.
Be sure to take the filter script out of debug mode by removing the “v” from the filename and using “False” for a value in the <Debug> section before using the filter script in an production environment. The pause in the command window will prevent the script from running without user intervention.
For example, one of the messages you may see while in debug mode is "Match not found". This would designate that your search criteria couldn't be found.
This makes tracking down problems in the script much easier by taking the guess work out of where the problems are occurring.
This concludes the video tutorial on how to debug your filter script.