Start Jobs

I have searched and read various responses but have no answer to the following:

How can I make a script or other action to “start Jobs” with my printer.

Using a HP Deskjet 6800.
The print application that opens when printing has the button “Start Jobs”.

I want to be able to invoke this action without opening the printer app.
But the printer app has no dictionary, thus I assume it is not itself scriptable.

Purpose.
Using a wireless printer which I cannot from my workstation know if it is on.
I will sometimes send a Word Doc to print and this causes the Deskjet 6800 print app to “stop jobs” if the printer is off.

I need to be able to, with one click, toggle that state. So the printer will “Start Jobs”
How?
While I am at it, I wouldn’t mind having a script to empty the queue?

alternate possibility or question:
a script or action that can tell me the printer is on.

On 12" 1.5gHz Powerbook, 10.4.7 Airport Xpress, HP Deskjet 6800 printer connecting wireless to Xpress.

Thanx

This will get the printer’s status:


tell application "Printer Setup Utility"
	set printerName to name of current printer as string
	set printerStatus to status of current printer as string
	quit
end tell

display dialog "Printer" & space & printerName & "'s status is" & space & printerStatus & "."

hi harmonz, capJ,

this script will check the queue status and start the queue if the printer is “Stopped”. jobs that are queued up should begin right away.



global printerStatus
set printerName to word 1 of (do shell script "/usr/bin/lpq")
pStat()

if printerStatus contains "is not ready" then
	do shell script "/usr/bin/enable " & printerName
	pStat()
end if

on pStat()
	set printerStatus to paragraph 1 of (do shell script "/usr/bin/lpq")
	display dialog printerStatus
end pStat

NOTE: you can comment out or remove the “display dialog” line in pStat to make it run silently. just there to show before and after. also, the second pStat() is not necessary for silent running.

EDITED: i put the second pStat() inside the ‘if’ statement. much better.

cheers.

Thanks waltr.

I was waiting for somebody to post a better way. I’ve just added to my Man Page collection (using Adams “Handy Hint for Man Pages” - http://bbs.applescript.net/viewtopic.php?id=15444)

j

Thanks, waltr, for the idea. I used it, with disable instead of enable, to stop jobs on a label printer after using it, so I wouldn’t spoil a lot of labels by accidentally printing a large document intended for a different printer. (I also set the current printer to something else.)

Note: After /usr/bin/enable or /usr/bin/disable, if you want to specify a printer by name, change any spaces or hyphens to underbars. To stop jobs on the printer named “Jean-Paul Sartre” the command is

Here is my entire script. I wrote as much of it as possible in pure AppleScript.

tell application "Printer Setup Utility"
	set current printer to printer "HP Laserjet" of application "Printer Setup Utility"
	quit
end tell
do shell script "/usr/bin/disable LabelWriter_330_Turbo"

I still have to remember to run the script when I am done with the label printer. I don’t know a way to script a quit handler for a non-AppleScript appication.