#!/usr/bin/perl # $Id: hpsetdisp.pl 11 2006-03-22 01:21:03Z yaakov $ # hpsetdisp.pl # Connects to a JetDirect equipped HP printer and uses # HP's control language to set the ready message on the # LCD display. Takes an IP address and message on STDIN. # My favorite message is "INSERT COIN". Keep in mind the # limitations of the display when composing your clever # verbiage. # # THIS PROGRAM IS PROVIDED WITH NO WARRANTY OF ANY KIND EXPRESSED OR IMPLIED # THE AUTHOR CANNOT BE RESPONSIBLE FOR THE EFFECTS OF THIS PROGRAM # IF YOU ARE UNCERTAIN ABOUT THE ADVISABILITY OF USING IT, DO NOT! # # Yaakov (http://kovaya.com/) use strict; use warnings; # user variables my $peeraddr = "192.168.0.5"; my $textfile = "/path/to/file"; # don't touch anything past this open my $fh, "$textfile" or die "can't open $textfile: $!"; chomp(my @textfile = <$fh>); my $rdymsg = @textfile[rand @textfile]; 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 = <