David (dblume) wrote,

HP Printer Ready Message "INSERT COIN"

Courtesy of our local HP printers and this awesome tip, I present today's python script:
from socket import *
import sys

printer = ""  # Change this to the IP of your printers
msg = "INSERT COIN"   # Or, AYBABTU for longer displays

if __name__=='__main__':
  if len(sys.argv) == 3:
    printer = sys.argv[1]
    msg = sys.argv[2]
  s = socket(AF_INET, SOCK_STREAM)
  send_message = \
    '\x1b%%-12345X@PJL JOB\n@PJL RDYMSG DISPLAY="%s"\n@PJL EOJ\n\x1b%%-12345X' % (msg, )
  s.connect((printer, 9100))
Tags: code, programming, python

  • My feed URL has changed

    If anyone here follows my personal blog with a feed reader, you'll have to change the feed URL manually. The old URL can't redirect to the new one.…

  • Progress on my Google+ and LJ backups

    Since Google is going to shut down Google+, I decided it was time to really make a home for my LiveJournal backup and my Google+ backup. Working…

  • In Case of Link-Rot

    If anything should happen to this journal, a backup of it should eventually appear at this location. I don't expect or plan for anything to happen…

  • Post a new comment


    Comments allowed for friends only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded