FileWatcher version 2.1.0
The Cadacus File Watcher Service will watch a directory for filenames that end in ".fw". These files will then be transferred to a Windows Printer without going through the print driver. This allows formatted files to be sent directly to a Windows printer. The program is designed to be used with the Shipping Solutions labeling service as a alternative to using Rawprint or the direct queue mechanism or with the e.Net business objects over webservices.
Click here to Download File Watcher Installer Released : February 23, 2016
Note: Filewatcher requires Microsoft.Net Framework 4.0; for more details on .Net Framework versions and links, see steps 2 and 3 here.
To install the FileWatcher service
- Download and then run the installer using the link above.
- Create a directory on the server for the FileWatcher to watch. The default directory is "c:\FileWatcher", but the installer will not create the directory automatically.
- If the watch directory is something other then the default, run REGEDIT and find "HKEY_LOCAL_MACHINE\SOFTWARE\Cadacus\FileWatcher". Edit the "Directory" key to match the selected watch directory.
- The default name of the queue translation file is "Queues.txt". If you want to use a different name for the queue translation file modify the QueueTranslation entry to point to the name of the file. If it is in the same directory that is being watched then the directory portion of the name is optional.
- Start the service "Cadacus File Watcher" in the Administrator Services Control Panel. The service will automatically start the next time the system is restarted. The services control panel can also be used to start the service manually.
- <WatchDirectory> - The directory FileWatcher is watching
- Queue - Tells FileWatcher to transfer the file to a Windows Print Queue
- <Printer Name> - The Windows Printer name
- <FileName> - Any unique filename
- .fw - The required suffix. Only files with this suffix are processed
Optionally a Queue Translation File can be used to make it easier to assign a printer to specific shipping station or handheld. The use and format of the translation file is explained below. If the translation file is used then the filename form is as follows:
The <Translation Name> will be checked against the translation file for the printer name.
The Queue Translation file is just a text file with a series of lines with one translation per line. Each translation is of the form:
<Translation Name>=<Printer Name>
- <Translation Name> - The information FileWatcher will find in the file name
- <Printer Name> - The Windows Printer name to send the file to
For example, if the <Translation Name> on the file is "Handheld" and the printer name to send the file to is "Label1", the following line would be in the translation file:
FileWatcher will look for a change to the Queue Translation file and automatically update itself. However, the best way to do this is to edit a separate version of the file and then copy the new file over the actual file. This prevents a problem of the editor having the file locked. You can also stop and restart the service to force the new file to be loaded.
There are some additional lines that can be added to the Queue Translation File. These lines are commands to the file watcher service. If any of these commands are desired they should be added to the file (one per line).
[DEBUG] or [NODEBUG] - Adds additional information to the logs (NODEBUG is the default)
[DELETE] or [NODELETE] -Deletes the files after they have been queued (DELETE is the default)
[FILELOG] <filename> or [NOFILELOG] - Logs information to the file designated by <filename>
[EVENTLOG] or [NOEVENTLOG] - Logs information to the system event log (EVENTLOG is the default)
[SAVE] - Appends to the current FileWatcher directory. Also, in the Queues.txt file in the FileWatcher directory, the command [SAVE] archive <CYMD> can be added. If the archive directory option is used, that directory must be manually created as the [SAVE] command does not create a subdirectory.
Using FileWatcher from a label control file
Configuring a label control file to use FileWatcher requires two steps.
- Remove any lines starting with [QUEUE]
- Add or modify the line starting with [FILE] to output the label to the filewatcher directory using the proper filename syntax.
Using FileWatcher to Generate a Crystal Report
A Crystal Report may be generated by using FileWatcher anywhere the Handheld or Shipping solution calls the labeling system.
As stated in the above "Format Filename" section of this tutorial, the typical FileWatcher format for sending a file to a printer is:
However, if it is desired to generate a Crystal Report, the FileWatcher format is:
The contents of this file is in XML format, as follows:
<CrystalReport> <Database>XXX</Database> <Report>verified_sheet_system.rpt</Report> <Parameter Name="Pallet ID" Value="P123" /> <SavePDF>Yes</SavePDF> </CrystalReport>
|Database||=||Specify the SQL database to use|
|Report||=||File name of crystal report|
|Parameter||=||Parameter to be sent to the report (multiple parameters are allowed)|
|SavePDF||=||Save a copy of the report as a PDF (Default = No)|
|Copies||=||Number of copies to print (Default = 1)|
|Name||=||Name of parameter in the report|
|Value||=||Value to which the parameter will be set|
|ReportPath||=||Path to where the Crystal report files are stored on the server|
|OutputPath||=||Path to where the PDF copies should be stored (if requested)|
|SQLServer||=||Specify the SQL server to use|
|SQLUser||=||SQL Username (must be SQL username, not windows authentication)|
|SQLPassword||=||SQL Password for Username (will be encrypted when Filewatcher is next restarted)|
- Remember the SQL Username and Password must be a SQL user-- Windows integrated security is not supported.
- The printer name will go through the same translation that it does for the standard "Queue" option.
- If the report fails to print, check the Windows Application event log for errors.