FileWatcher

The Cadacus File Watcher Service will "watch a directory" for filenames that end in ".fw".  When an ".fw" file is placed in the watched directory, 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.

As an alternative to using Rawprint, the direct queue mechanism, or the e.Net business objects over webservices, this program is designed to be used with 1) the Shipping labeling service and/or 2) the Handheld WMS.

Click here to Download File Watcher Installer Released : April 25, 2024

Important note:  Filewatcher requires Microsoft.Net Framework 4.0; for more details on .Net Framework versions and links, please check with your local systems administrator.


 

Install the FileWatcher service

  1. Download and then run the installer using the link above.
  2. 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.
  3. 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.
  4. Start the service "Cadacus File Watcher" using Notepad (right-click "Run as", Administrator). 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.

 

Format the FileWatcher file name

The filename must use the following format:
 
<WatchDirectory>\Queue.<Printer Name>.<FileName>.fw
     
     Where:
<WatchDirectory>  -  The directory FileWatcher is watching
Queue  -  Tells FileWatcher to transfer the file to a Windows Print Queue
<Printer Name>  -  The Windows Printer name  OR  the code in the windows translation file
<FileName>  -  Any unique filename
.fw  -  The required suffix.  Only files with this suffix are processed

 

The Queue Translation File

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>

Where:

<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:

Handheld=Label1

FileWatcher will only look for updates to the configuration file at startup time.  Please restart the service if changes are otherwise desired.

 

FileWatcher Configuration

The FileWatcherService.exe.config is the first configuration file used to point to the proper file changes.

filewatcher_config1.png

  1. The "Watch" directory
  2. The "Queues.txt" location
  3. The "Save" path 

filewatcher_config2.png

 filewatcher_dos.png

 filewatcher_windows_log.png


Using FileWatcher from a Label Control File

Configuring a label control file to use FileWatcher requires two steps.

  1. Remove any lines starting with [QUEUE]
  2. 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 in the Handheld WMS or Shipping solution calls to 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:

<WatchDirectory>\Queue.<Printer Name>.<FileName>.fw   

 However, if it is desired to generate a Crystal Report, the FileWatcher format is:

<WatchDirectory>\Crystal.<Printer Name>.<FileName>.fw  

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>
Where:
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
The new registry entries for the Crystal configuration to set access to the SQL server:
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) 
Notes:
  • the Crystal report is completely responsible for all database access.
  • in the report, all database connections must be done use OLE DB (not ODBC, or any other method). If the report is being created on a different machine from the server, the same provider that is available on the server should be selected during the OLE DB setup.
 

Other considerations:

  • 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.