I’m writing in the hope that someone has solved some of these problems already.
For various reasons, I want to remove all references to the Printer Setup Utility in my scripts, and replace them with shell commands. I see that I can use lpoptions and lpstat for most purposes, and I wonder if anyone has already figured out how to do the following:
-
I distribute some scripts that check whether a printer is available, before trying to print. How can I use the output of lpstat to check the number of “enabled” printers? (I want to count printers that are listed as “enabled”, not the ones that are listed as “disabled”.)
-
How can I get the name of the default printer through a shell command?
-
I use this code to print a file and report whether a file is still being printed. How is it possible to do this with shell commands instead of “Printer Setup Utility”:
tell application "Printer Setup Utility"
open thisItem -- "thisItem" is the file being printed
tell application "System Events"
repeat while (busy status of thisItem)
delay 1
end repeat
end tell
quit
end tell
Many thanks for any help with any or all of these questions.