LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Printing queue management

I'm not sure this is really a "LabVIEW" problem, but I was looking for someway to solve it from within my program.
 
In my application, I am automatically printing out a 2 page test report approximately every 15 minutes. (I do this by calling a VI, and printing it out using the 'Print this VI when completed' option.) The problem is that after some time, the print queue eventually builds to a large amount of printouts and begins to bog down system performance. I am assuming that this is because the printer is running out of paper or has jammed; but I can't be sure since I am not local to the site where the software is running.
 
Is there some way from within LabVIEW for me to determine if there has been a problem printing out my reports, or if the printer status is OK? I am printing to a HP Laserjet 1022n that is just plugged into the LAN. There doesn't seem to be an API in any of the manuals I've looked at for me to send a message to the printer via the network to get the size of the print queue or anything like that. The PC is running Windows XP.
 
Has anyone dealt with similiar problems, or have any ideas? The best that I've been able to come up with is just to task schedule in windows a reset of the print spooler at a regular interval to stop this from happening. (Which is not really a good solution to the real problem.)
 
 
0 Kudos
Message 1 of 3
(3,680 Views)
A simple solution might be to open a command prompt using the SYSTEM EXEC.VI (essentially a container for a CIN {Code Interface Note}) and issue the NET PRINT command which will return a list of jobs in the printer queues.
You could then work out if jobs were being printed or not and subsequently decide if to warn the user or selectively delete print queue items.

You will get a list of all print queus so you may need to have the user indicate a specific print queue or server.

The other option is to start accessing the Windows API to obtain printer que information, the former is likely to be the fastest to implement, if tedious.

Below is a sample output for a computer without print queue
"NET PRINT
\\computername\sharename
          [\\computername] job# [/HOLD | /RELEASE | /DELETE]


NET PRINT displays print jobs and shared queues.
For each queue, the display lists jobs, showing the size and status of each job, and the status of the queue.

\\computername        Is the name of the computer sharing the printer queue(s).
sharename                Is the name of the shared printer queue.
job#                          Is the identification number assigned to a print job. A computer with one or more printer queues assigns each print job a unique number.
/HOLD                       Prevents a job in a queue from printing.The job stays in the printer queue, and other jobs bypass it until it is released.
/RELEASE                Reactivates a job that is held.
/DELETE                  Removes a job from a queue.
"

0 Kudos
Message 2 of 3
(3,668 Views)

Here is a link to some .vbs script examples that show how you can monitor print queues. You need to be using windows and have scripting enabled.

http://www.microsoft.com/technet/scriptcenter/scripts/printing/servers/default.mspx

0 Kudos
Message 3 of 3
(3,664 Views)