
Fun With C# and HP Laserjets - rayvega
http://odetocode.com/humor/68.aspx
======
chopsueyar
I found this written in Ruby several years ago. My two favorites were, "INSERT
COIN" and "ADD WATER".

Of course, this is only really effective when large groups use the same
printer.

It was mentioned somewhere as an IT prank for April Fools day.

~~~
chopsueyar
It was in the comments section...

#!/usr/bin/env ruby

# Simple HP Printer Hacker

# Written in Ruby by Erik Gregg

# 6/9/06

# Status Usage: hp-message.rb <host> status

# Message Usage: hp-message.rb <host> message "<message>"

require 'net/telnet'

    
    
      begin
    
      if ARGV[0].nil?
    
       puts "Read the script.
    

Status Usage: hp-message.rb <host> status

Message Usage: hp-message.rb <host> message \"<message>\""

    
    
       exit
    
      end
    
      host = Net::Telnet::new("Host" => ARGV[0],
    
                              "Port" => 9100,
    
                              "Timeout" => 5,
    
                              "Prompt" => /\b/n)
    

if ARGV[1] == "status"

    
    
      host.cmd("@PJL INFO STATUS") { |c| print c }
    

elsif ARGV[1] == "message"

    
    
      host.cmd("@PJL RDYMSG DISPLAY=\""+ARGV[2]+"\"")
    

else

    
    
      puts "Oh Cmon.  Look at the syntax inside me."
    
      exit
    

end

    
    
      host.close
    
    
    
      rescue Timeout::Error
    
            puts "Time to go now!"
    
            exit 1
    
      end

~~~
jrockway
Sigh, it's "OUT OF WATER", not "ADD WATER". Only very new printers tell you
how to resolve the problem ("Add Letter paper to tray 1"); old printers just
tell you what the problem is. ("PC LOAD LETTER? What the fuck does that
mean?")

And for the OP, it's "INSERT COIN" not "INSERT QUARTER".

~~~
joezydeco
Hey, give 'em a break. He's probably too young to have ever seen a real arcade
game.

------
joe_bleau
I did this years ago with an HP-48 calculator (serial port connected to
laserjet): not only did I fool with the LCD panel, I generated postscript and
printed, too.

Here at work I've found that many of the newer all-in-one laser
photocopy/scan/print machines support this HP PJL feature. I drive it from a
cron job to give a countdown to major events (trade shows, holidays, etc.)

The best part is when the copier dude comes in to service the machine: "how
does the copier know when your trade show is?"

------
henning
Boy it's a bummer when people post code online without attaching a license to
it.

~~~
jrockway
Yeah, writing 1 line of text to a TCP connection is pretty hard, so if you
can't use this code freely, your app is ruined...

