Clear Print Que

I just hit print while on the wrong screen. That doesn’t happen very often but when it does I have to fumble around to find the print Que and stop it. I just wasted a dozen sheets of paper before I could stop the print job.

I am thinking that this would make a good macro for KM if KM can stop and clear my print Que with a key stroke.

From this site http://paulgurney.com/whats_new_blog/2011/09/mac-os-x-how-to-clear-the-print-queue, it appears I can use a terminal command to halt and clear the print que.

$ cancel -a

If I am correct, an execute shell script essentially is the same as putting something in Terminal and executing. I tried this as a macro in KM, execute shell script, execute text script, $ cancel -a.

It errored on launch of the macro but it went by too fast to have read the error. I can try again and save the error message if it matters.

Thanks

Are you just using “cancel -a” and skipping that dollar sign prompt?

No, I did it just as I showed. Should I have dropped the dollar sign?

I just tried print 4 pages and then hitting the macro and also entering cancel -a in terminal. Nothing seems to actually stop the printing once it has begun.

The dollar sign is just a generic representation for your system prompt (which could be anything, actually). So don’t include that in the script.

I can’t vouch for “cancel -a” although I did see it mentioned a couple of places on the Web. In fact, this AppleScript (http://hints.macworld.com/article.php?story=20060210170203159) uses “cancel -a -” instead.

You don’t need the AppleScript just the “cancel -a -” in the action’s text box.

It errored when I added the last dash.

One thing I am beginning to realize is that, if I accidentally get a large print job going and I want to stop it, this may not stop the print job once it has begun. If memory serves the print job gets cached to the printer. Then the print que can be stopped before it loads the next print job into the printers cache.

If true this would mean that I have to first reach over and pull out the paper tray or hit stop to force the printer to stop, then do the macro to clear the que. Hmmm, now I am confused. Can I stop the printing after accidentally starting a large print job - or not?

Hmmm, according to this (http://man7.org/linux/man-pages/man1/cancel.1.html) you don’t need that trailing hyphen. Just “cancel -a” should “Cancel all jobs on the named destination, or all jobs on all destinations if none is provided.”

If the horse has left the barn (job completed on the computer because all the data has been sent to the router or the printer), then shutting the printer off is the most reliable solution. That will kill the job (pulling the tray won’t).

This:

Execute a Shell Script.kmactions (641 B)

Did seem to work if I got in quickly. As you say, if the printing has gone through to the printer, then it may be too late to cancel the job.