HomeTutorialsHandheld SolutionFileWatcher version 2.1.0
 

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

  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. 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.
  4. 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.
  5. 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.

Format of the Filename
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
  • <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:

 

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

 

The <Translation Name> will be checked against the translation file for the printer name.

 


Format of 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 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.

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

 <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
  
There are 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) 
 
Please note that the Crystal report is completely responsible for all database access.
NOTE:  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.

Why CADACUS SOLUTIONS FOR SYSPRO?

Since 1991, as developer of the standard EDI, Shipping, and Freight Calculator Solutions for SYSPRO, our products are fully integrated with SYSPRO and drive efficiencies for hundreds of users worldwide.

Why SYSPRO?

For 35 years, SYSPRO has had a single product focus resulting in an award-winning ERP system with a track record of success for over 14,000 customers worldwide.