Is it possible to reset printer without printing?


As part of my app, I’m listing printers and a summation of their state. However, when requiring Paper, I have to wait until the new paper is inserted, and a job is printed, before the needs-paper indicator is reset.

Can I update my printer status during an every-5-second-loop check, once paper is inserted?

Something similar to this is called every 5 seconds.

set thePrinters to (do shell script ("lpstat -a | awk '{print $1}'")) as text
set printerList to {}

repeat with x from 1 to count of paragraphs of thePrinters
	set printername to paragraph x of thePrinters as text
	set defaultPrinterState to do shell script ("lpstat -p & printername)
	set defaultPrinterProperties to do shell script ("lpoptions -d " & printername as text)
	set end of printerList to defaultPrinterState & return & return & defaultPrinterProperties & return & "______________________________________________________" & return & return
end repeat

It returns…

", "printer Quark_Printer is idle. enabled since Sun May 31 21:19:21 2015
Waiting for job to complete.

copies=1 device-uri=dnssd://HP%20LaserJet%20200%20color%20M251nw%20(4C7452)._ipp._tcp.local./?uuid=434e4631-3030-3233-3538-7446a04c7452 finishings=3 job-cancel-after=10800 job-hold-until=no-hold job-priority=50 job-sheets=none,none marker-change-time=1430993572 marker-colors=#000000,#00ffff,#ff00ff,#ffff00 marker-levels=10,10,10,20 marker-low-levels=20,20,20,20 marker-names=black,cyan,magenta,yellow marker-types=toner,toner,toner,toner number-up=1 printer-commands=ReportLevels printer-info=‘Quark Printer’ printer-is-accepting-jobs=true printer-is-shared=true printer-location printer-make-and-model=‘HP LaserJet 200 color M251’ printer-state=3 printer-state-change-time=1433071161 printer-state-reasons=cups-ipp-conformance-failure-report,cups-ipp-missing-send-document,media-needed printer-type=8425548 printer-uri-supported=ipp://localhost/printers/Quark_Printer

I can post a message if defaultPrinterProperties contains media-needed, but I would like to reset the message once paper is inserted into the printer, and the printer itself no longer says it needs paper.

I would imagining this requires I somehow reset the printer without actually printing.

Any way of updating the codes ("lpoptions -d " & printername as text)?



Model: Late 2014 retina i7, Yosemite
AppleScript: 2.4
Browser: Safari 600.2.5
Operating System: Other

I should explain exactly what’s happening.

With my second printer, an HP Laserjet Pro 200 color, if the paper runs out when printing the last page of a job, the printer signals a ‘paper-out’ message, and my script then reads a ‘media-needed’ request in the defaultPrinterState variable.

If I put paper into the printer, the printer turns off the request-for-paper message, but the ("lpoptions -d " & printername as text) still returns the ‘media-needed’ request.

The Mac operating my App displays summation messages reflecting the printers State & Properties, for two nominated printers.

My clients operate 4 printers in a noise isolated room, an A4 and an A3 high speed lasers, with redundant backups. I’d like to change my printer summation messages display to reflect the fact that the printer no longer needs paper, without waiting for another print job to clear the message.

I hope this clarifies why I want to update the printer properties.