Finding out status of printspooler empty or not

jack niekerk
jack niekerk used Ask the Experts™
on
Finding out status of printspooler empty or not
In Vb6 we do shelling this

I use ( advised by : Steve Knight )   this to turn a printer(s) off line
cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet One" +workoffline
cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet Two" +workoffline
this 5 total printers

Then start the job by setting the first printer on line
 cscript "C:\Windows\System32\Printing_Admin_Scripts\nl-nl\prncnfg.vbs" -t  -p "HP OfficeJet One" -workoffline
Start printwork for this one

Now before turning next printer on line I must know that spooler for this first Job is empy at printer
then next job , etc.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Have a look with this:

cscript prnjobs.vbs -l -p "Printer name"

You could read the output of that or redirect it into a file with > "%temp%\somefile.txt" and then read it in your VB6 with environ$("TEMP") & "\Somefile.txt" etc, I haven't checked if it sets an errorlevel or not but can later.

Steve

Author

Commented:
Yes that works,
see while on hold this in >> redirected text

Task-id 224
Printer HP OfficeJet Pro 8710 (netwerk)
Document Testpage
Gegevenstype RAW
Status
Time 12/20/2019 15:04:37
Total pages 1
Total  jobs in inventory 1

and when done this


Total  jobs in inventory 0

So can do a loop with cscript prnjobs.vbs -l -p "Printer name"
untill i get this  output file and start next job

Thanks again !

Commented:
Good, can look for other options too if needed - there, e.g. might be more efficient way with Powershell but frankly if I can get a simple bit of text like that easy enough to parse as you know - between batch, vbs, powershell if you can output something you can check it even in old VB.  Been good few years since I've written anything in VB6 but regularly have to parse info out of text files, XML etc. with VBScript, VBA, LotusScript due to having to solve 'not possible' issues.

Steve
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

Author

Commented:
this works fine for me,  the reason is i have a printer with 5 color trays, one output bin
have to  print orders with lines in it wich has to go by department to some color output
now they must sort by hand  1000+  papers by color!
Thus i can make flow all offline  run the program , everything is hold
When done , start first color   (can count wich are the most during job )
then if spooler empty next color.  
everything will be sorted then by color!

Regards Jack

Commented:
Clever ideas, or you need a printer with multiple output bins :-)

Steve

Author

Commented:
Its a Kyocera , max they have is 2 output bins, so no option anyway

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial