kieranbarnes Independent PHP, WordPress & CubeCart Programmer

Insert Coin

Posted on July 17, 2009

Bored at work? This script 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 the command line. My favorite message is "INSERT COIN".

Keep in mind the limitations of the display when composing your clever verbiage.

insert_coin

#!/usr/bin/perl
# $Id: hpsetdisp.pl 11 2006-03-22 01:21:03Z yaakov $

# hpsetdisp.pl

use strict;
use warnings;

unless (@ARGV) { print "usage: $0 ""n" ; exit }
if ($ARGV[3]) { print "Did you forget the quotes around your clever
message?n" ; exit }

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 = <
e%-12345X@PJL JOB
@PJL RDYMSG DISPLAY="$rdymsg"
@PJL EOJ
e%-12345X
EOJ
;

print $socket $data;



Related posts

  1. WP-o-Matic fix for WordPress 2.5
    WP-o-Matic makes autoblogging a easy by automatically creating posts from the RSS/Atom feeds you give...
  2. Fixing cPanel File Permissions
    Sometimes users mess with their own file permissions that they no longer work. They will...
  3. What is the difference between ‘learnt’ and ‘learned’?
    Apparently, not much. These are alternative forms of the past tense and past participle of...
  4. [Snippet] Forcing Replication Between Domain Controllers
    ...because some people still don't know! Open Active Directory Sites and Services. In the console...
  5. Using WP-Ecommerce Product Downloads without checking out
    I've used WP-Ecommerce for a few clients who required an online catalogue, rather than an...

Tagged as: , , , Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.