Knowledge Base

NiceWatch does not process the JOB trigger file, when you set a trigger to delete the file


You have set up NiceWatch --middleware integration module-- to monitor changes in JOB files in some folder. NiceWatch is set up to monitor a folder for set of JOB files, not just individual JOB file. The JOB files contain NiceCommands, batch commands to control label printing using NiceLabel Pro as the print engine. NiceWatch detects the change in the timestamp of JOB files and sends the files to NiceLabel print engine.

You also enable the option Delete the trigger file in trigger options (Trigger Properties dialog box -> File tab -> Execution Options button -> Delete the trigger file), the trigger file will be deleted, when the its processing is finished.

But printing fails.

NiceWatch reports an error in the log pane. The error is:

[8/9/2006 9:20:06 AM] Trigger: 1 - Trigger was executed at 8/9/2006 9:20:06 AM. File which executes the trigger is "D:\Jobs\LINE1.job"
[8/9/2006 9:20:06 AM] Trigger: 1 - Action: Run job. - Job file "D:\Jobs\LINE1.job".
[8/9/2006 9:20:06 AM] Trigger: 1 - Print thread action: Run job. - Error processing job file! Error occurs at processing job file: "D:\Jobs\LINE1.job" Print server error message: Error opening job file!

The error message "Error opening job file" comes from the print engine, not from NiceWatch. You can see the error message origin looking at the log pane (Print thread action specifies print engine as the author). The print engine does not find the JOB file for printing. Apparently JOB file was deleted before it could be used by the print engine.

NiceWatch is multi-threaded application and can accept many simultaneous incoming connections, several triggers can execute at the same time. NiceWatch processes the incoming data:

  1. The trigger gets an ID number.
  2. NiceWatch creates internal job requests for printing.
  3. The request for printing is put on the queue list (FIFO).

When the available print engine is idle, it will be assigned with the request from the queue. However, if the original JOB file was already deleted, the error Error opening job file will occur.


You can still delete the trigger file, but you must modify the actions for your trigger. Your list of actions contains the action "Run JOB". Because you monitor set of JOB files in some folder, you already use the internal variable TriggerFileName as the JOB filename. The variable TriggerFileName contains the real name of the JOB trigger file that actually changed. However, NiceWatch deleted the original trigger file as soon as the trigger was processed (and request for printing put on the queue list)

Do not use internal variable TriggerFileName. Instead use the internal variable DataFileName. Whenever a trigger file is detected NiceWatch always creates a temporary backup of the trigger file. The internal variable DataFileName points to the folder and filename of the backup trigger file.

As long as the request for printing is active in the queue list, the backup trigger file exists in the file system. When the print engine completes printing of the JOB file, the backup trigger file is removed.

Print document   Email document


Did this article help you? *