So at work we’re using these little Dymo label printers to do the smaller labeling jobs departments need. They are cheap and durable but don’t use standard formats or language — you can’t send plain text to them and hope to get anything useful. You have to use their software. Fortunately they provide you with code examples for accessing the coms and dlls and other junk the software installs when you first set up a printer. Oh, and you have to have a visible label printer in order to install the software.
So why am I having to code a custom app to use the little buggers you may ask? Why, it’s because we’re managing all of them out in their separate departments via a single computer! And we’re sending jobs to them from Unix! My job has been to take the label jobs, which are parsed and hacked up plain text files from student records, from Unix to my poor little Optiplex GX270 (not the one with Ubuntu) running WinXP and then send them out to the appropriate departments in a language and format the Dymo’s understand. Yes, I have to use WinXP because the people who will be operating and maintaining it are students who may or may not have computer experience and most very exceedingly likely will only know WinXP. So I found a program that will handle the queues, found the printers, modified the code the printers’ sdk came with to work for our purposes, made the crazy batch file that handles calling the program from the server, documented everything… . Now, I discover that the way the Dymo software knows a printer is available is from the local list of printers. Which may or may not reflect which computers at the various departments are actually powered on and receiving for their little counterparts. Yes, I had to connect the printers to an actual computer and then share it over the network. If you can find a label printer that is stand-alone network capable for under $100 I will cry in frustration cuz I already looked.
So I have to call net print from my batch file and sort through the resulting vomit to find error code 1231 or whatever. Yeah, the batch file. Since there’s no way to easily configure my program that prints to the printers everything is being handled in the batch file. The alternative is to hard code crap into my program. I suppose I could make an editable text file and call it from the program for settings, but gmeh. I’ve come this far. Besides, batch files have known syntax and breaking and such so that would be one less thing I’d have to document or watch out for.
If you do know a better way, or a relatively easy way, let me know. Right now the only thing the program does is take the printer name, a path for the filename, and an optional switch for landscape or portrait labels. If you get the printer name wrong it spits out a list of acceptable printers. It returns 0 in success, 1 for bad printer name (and a couple of other things irrelevant to this discussion), and 2 for failure to print. Which I haven’t been able to generate yet. The batch file attempts to handle everything else. It will keep trying until it times out and then it will send an email to the operator outlining the failure and which file it was so the job can be repeated. The server leaves a copy of the job in the queue directory (for reprinting) so the batch file also deletes anything older than ten days to save disc space. Am I an idiot? I’m not skerred, just give it to me straight.
Update: I also tried finding the printers in my program but I couldn’t for the life of me figure out how. I think the main problem is that I have to edit and compile based on an existing Visual Studio project and therefore have no control over the headers (the one I want is already included but I cannot use the functions I need). So much of the coding that could go into the program is out of my inexperienced hands. Fortunately it turns out that net print has return codes so adding it to the batch file was much simpler. Now the batch file checks for the remote printer for about a day, and if it fails it sends an email to the operator with enough info for the job to be repeated.