LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

can I query for a printer on LPT1 before printing?

Solved!
Go to solution

I am developing an application where the printer is on another computer and cannot be put on the network or shared and is too busy to be moved to my computer. I would like to be able to query for the presense of the printer before I print from labview. This would allow me to avoid having to disable the line to the printer when on my desktop and enable it when I build a test app that is run on the target machine. I can't send an IDN? since that is simply printed.

 

Any ideas?

 

Tay

0 Kudos
Message 1 of 7
(3,336 Views)
Solution
Accepted by slipstick

What kind/brand of printer are you using?  Is the LPT1 port setup to be bidirectional?  I think you will need to look in the programming manual for the printer to see if there are any kind of special codes (such as escape codes) you can send that would cause it to respond back with information that you can read.

Message 2 of 7
(3,311 Views)

My first thought on how to solve this didn't turn out to be so easy.

 

Here's my second thought:

 

Make a configuration file on each PC.  Only one parameter in it -- printer_exists (boolean).

 

Retrieve the key in the print part of your program... and if it's false, don't print it.

-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 3 of 7
(3,308 Views)
It's a Zebra barcode label printer. I'll have to look tomorrow at whether it is set up as bidirectional; my recollection is that it is. And that's a good thought about the escape codes. I'll look into it tomorrow.
0 Kudos
Message 4 of 7
(3,304 Views)

Nice idea Matt! This'll certainly work, but I do want to see if I can get it to return some kind of info first. I'll let you guys know tomorrow how it goes.

 

Tay

0 Kudos
Message 5 of 7
(3,303 Views)
zebras are bidirectional (at least the ones I have used are).  You could ask it something inocuous, like what the system font size is.  Can't remember much about them (used them in 2005), but I remember you could do some things like that.
-Matt Bradley

************ kudos always appreciated, but only when deserved **************************




Message 6 of 7
(3,297 Views)

Well, I wasn't getting any response out of the printer to the commands I was sending, but if I read bytes at port on a PC with no printer I return an error code. If I read bytes at port on a PC with a printer I get 0 or perhaps some number. Viola!

 

Thanks guys!

 

Tay

0 Kudos
Message 7 of 7
(3,259 Views)