Created
January 15, 2016 21:25
-
-
Save skreuzer/b29f788592cbeb47211d to your computer and use it in GitHub Desktop.
Change the LCD Display Message on HP LaserJet Printers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/python | |
import socket | |
import sys | |
if(len(sys.argv) != 3): | |
print('usage: rdymsg.py PRINTER MESSAGE') | |
sys.exit(1) | |
printer = sys.argv[1] | |
message = '\x1b%%-12345X@PJL JOB\n@PJL RDYMSG DISPLAY="%s"\n@PJL EOJ\n\x1b%%-12345X' % (sys.argv[2]) | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP) | |
s.connect((printer, 9100)) | |
s.send(message) | |
s.close() | |
sys.exit(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment