Skip to content

Instantly share code, notes, and snippets.

@codemonkey2841
Created December 16, 2014 04:21
Show Gist options
  • Save codemonkey2841/c62c1260f7630b7c2f0e to your computer and use it in GitHub Desktop.
Save codemonkey2841/c62c1260f7630b7c2f0e to your computer and use it in GitHub Desktop.
Change the LCD display on HP printers
#!/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