[rescue] my first big iron! and a couple of questions:
Linc Fessenden
linc at thelinuxlink.net
Sat Jan 3 10:00:26 CST 2004
On Sat, 3 Jan 2004, Kris Kirby wrote:
> On Fri, 2 Jan 2004, Bill Bradford wrote:
> > I'm still a big fan of "INSERT 25 CENTS" on older Laserjets. 8-)
>
> STORY. How can I do this?
Perl Script below:
------------------------------------------------------------------------
#!/usr/bin/perl
# phubbard at computer.org 10/23/02
#
# Quick hack to set the 'ready' message on HP networked printers, via the
# PCL command to do so. See http://www.phfactor.net/code/hpset/
use IO::Socket;
use Getopt::Std;
# Variables
$string0 = "o2345X";
$string1 = "\@PJL RDYMSG DISPLAY=";
$msg = "";
$printer = "";
$port = 0;
# Parse the command line - machine, port or help
getopts('m:p:h');
$printer = $opt_m || "localhost";
$port = $opt_p || 9100;
if ($opt_h)
{
print "\nSyntax: hpset {-m machine} {-p port} string\n\n";
exit;
}
# Pull display string from command line
$string2 = join(' ', @ARGV);
if (!$string2)
{
die "Syntax: string argument";
}
# Open the TCP connection
$socket = IO::Socket::INET->new(PeerAddr => $printer,
PeerPort => $port,
Proto => "tcp",
Type => SOCK_STREAM)
or die "Couldn't connect to $printer:$port : $@\n";
# set message
$msg = $string0 . $string1 . "\"" . $string2 . "\"" . "\n";
print $socket $msg;
$msg = $string0 . "\n";
print $socket $msg;
close($socket);
exit;
---------------------------------------------------------------------
--
-Linc Fessenden
In the Beginning there was nothing, which exploded - Yeah right...
More information about the rescue
mailing list