Created
December 16, 2014 04:21
-
-
Save codemonkey2841/c62c1260f7630b7c2f0e to your computer and use it in GitHub Desktop.
Change the LCD display on HP printers
This file contains 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/bin/perl | |
use strict; | |
use warnings; | |
unless (@ARGV) { print "usage: $0 <ip address> \"<RDYMSG>\"\n" ; exit } | |
if ($ARGV[3]) { print "Did you forget the quotes around your clever message?\n" } | |
my $peeraddr = $ARGV[0]; | |
my $rdymsg = $ARGV[1]; | |
chomp $peeraddr; | |
use IO::Socket; | |
my $socket = IO::Socket::INET->new( | |
PeerAddr => $peeraddr, | |
PeerPort => "9100", | |
Proto => "tcp", | |
Type => SOCK_STREAM | |
) or die "Could not create socket: $!"; | |
my $data = <<EOJ | |
\e%-12345X\@PJL JOB | |
\@PJL RDYMSG DISPLAY="$rdymsg" | |
\@PJL EOJ | |
\e%-12345X | |
EOJ | |
; | |
print $socket $data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment