Home › Forums › Knowledge Base › Edit Pro › Handling Global Printer Errors
- This topic has 0 replies, 1 voice, and was last updated 19 years ago by
Rob.
-
AuthorPosts
-
April 15, 2006 at 3:00 pm #1672
Rob
MemberHandling Global Printer Errors
Back in the old days, the only way to know that the kitchen printer had stopped printing was when the cook got around to telling someone that he hadn’t received any orders lately. Then Touchnet version 4.40 showed up, and suddenly we had the ability to detect at the workstation when a global printer was not printing. This made it possible to style in an error window, informing the server that the printer was not printing. However, an error window is just the start of a range of possible uses for this feature. Before I go any further let me mention that Creative Depths has a wonderful product called PrtRedir that uses global printer error checking to provide temporary or permanent redirection via a set of user friendly screens. This tip is for those of you who just have to do it yourselves (and you know who you are). Let’s start by understanding how global print error detection works.
How It Works
When a Print To statement is executed, Touchnet actually makes two network calls. The first one sends the print job to the global printer as specified in Printer Definitions. It then makes a second call to the print server for that printer to get the status of the port. If the port is transmitting data, Touchnet will set the Status variable to zero. If no data is going out the port, then Touchnet assumes that there is a problem with the printer and sets the Status variable to one. Additionally, if the Display Global Print Errors option is turned on in Global Options, Touchnet will display an error message to the user. The power comes with the Status variable. By adding an If Status>0 statement after the Print To, you can add your own error handling, as the following sections illustrate.
[img:18xkwno3]http://www.possupport.net/dealer/kbase/images/glblerr1.gif[/img:18xkwno3]
The Custom Error Window Trick
Suppose you want to provide some additional information to the server when an error has occurred, or maybe you just don’t like Touchnet’s error window. Go into Global Options and turn off the Display Global Print Errors option. Then design your own window and style it in with something like this:
[img:18xkwno3]http://www.possupport.net/dealer/kbase/images/glblerr2.gif[/img:18xkwno3]
Print to KitchenIf Status > 0
Window = PrtError
Accept Touch
Close 1 Window
End IfThe Automatic Printer Redirection Trick
Here’s one that gets requested once in awhile. Instead of just reporting the error, Touchnet can automatically reroute the print job to an alternate printer. Be careful with this one. A nasty programming thing called recursion can mess things up if you try to get to fancy here, but take a look at this simple little routine:
Print to Kitchen
If Status > 0
Print to BarIf Status > 0
Window=PrtError
Accept Touch
Close 1 Window
End If
End IfThe Give the Server Some Options Trick
You can have your cake and redirect it too. Suppose you want to give the server the option of sending the print job to another printer or leaving it in the print queue until the problem is fixed. Try this on for size:
[img:18xkwno3]http://www.possupport.net/dealer/kbase/images/glblerr3.gif[/img:18xkwno3]
Print to Kitchen
If Status > 0
Window=PrtError
Accept Touch
Close 1 WindowIf Branch=1
Print to BarIf Status > 0
Window=PrtError2
Accept Touch
Close 1 Window
End If
End If
End IfOne Last Really Cool Trick
One thing that Touchnet can’t do is cancel the print job after it has been sent. This means that if it resends the print job to the second printer, the job will still print at the first printer after that printer comes back on-line. Out of luck? Never! There is a clever solution that came to us from Randy Cartlidge of Hospitality Data Systems, one of our Application Developers. Randy, seen at right doing the company laundry, came up with the idea of sending a dummy print job that doesn’t actually print anything, then sending the real print job based on the error status of the dummy job.
[img:18xkwno3]http://www.possupport.net/dealer/kbase/images/randy.jpg[/img:18xkwno3]
To accomplish this you need to first make a print template called Dummy and put forty lines of {SET Black Print} on it. Why forty lines? Well, if you send a template of less than about 20 to 40 characters, you can get a false error message because the print job has completed before the print server gets around to checking to see if data is going out the port. Then style in the template like this:
Do Template Dummy
Print to KitchenDo Template Kitchen
If Status > 0
Print to BarIf Status > 0
Window=PrtError
Accept Touch
Close 1 Window
End IfJump to ‘END’
End IfPrint to Kitchen
‘END’ -
AuthorPosts
- You must be logged in to reply to this topic.