A quick search shows that this question has been asked before but never satisfactorily answered here. I have a USB printer connected to my AirPort Extreme (first generation, I think) so I can access it from two Macs and an iPad. What stymies me is detecting whether the printer is powered up – it always shows as my printer, e.g.,
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
always displays that the printer is ready even if it’s turned off.