Free Republic
Browse · Search
General/Chat
Topics · Post Article

Skip to comments.

Fun With C# and HP Laserjets
OdeToCode.com ^ | 12/28/2003 | Scott Allen

Posted on 01/27/2005 2:43:49 PM PST by Constitutionalist Conservative

Using sockets and C#, you can customize the display of a networked HP Printer.
 
I wasn’t sure if I should put this article under “Code” or “Humor”, since it contains both. Ultimately it is much funnier than technical, but full source is included for you to use in your own environment.

I was studying the C# language one day and thought back to earlier in my career. Back then I was learning the assembly language for a little 8 bit Hitachi CPU (the 6303) in order to control a small thermal printer. With the right control codes you could get the printer to display a custom message on the LCD. Then I was walking by the HP Laser printer in the office and wondered if I could do the same here. Once I uncovered the Printer Job Language Reference from HP, I realized this could be fun. After all, who would not get a kick out of a printer with the message “TOUCH ME” on the LCD?

So I wrote some C# and had everything working. I put a list of messages together for the program to display at random and setup a scheduled task to execute the assembly every hour. It didn’t take long for people to notice and start commenting. Some people would check the printer for a new message on every trip. I remained completely silent as to my knowledge of the origin of these messages.

At one point I disabled my scheduled task because our chief network admin had made it his mission to stop the printer hacking. After locking down everything on the printer he possibly could, the messages still got through, but I figured the joke had run it’s course. Then, when everyone realized we were going out of business, I turned it back on for a little bit of amusement everyday.

After the company was sold and I did some consulting for the buyer, I setup the program in their office too. I had it hit an HP printer nearest the engineering cubicles, where at least one guy I know slept behind his high cubicle walls every afternoon for an hour. It never raised many eyebrows that I know of while I was there, but afterwards someone told me they knew one lady who stopped at the printer every day “because it says such nice things to me”. If I can brighten one person's day, every day, my mission is accomplished.

The following listing is the code to pull it off. I think the selection of random messages is quite funny to see on a printer, but feel free to modify these to match your own sense of humor. To use the program just add the IP address of the printer and a message in quotes, or type "random" for the message to select from the random message list.



TOPICS: Computers/Internet; Humor
KEYWORDS:
Click the link to see the source code. Looks like fun!
1 posted on 01/27/2005 2:43:49 PM PST by Constitutionalist Conservative
[ Post Reply | Private Reply | View Replies]

To: Constitutionalist Conservative
BWAHAHAHAH... I'd love to see the face of the person getting to the copy machine when this message is displayed:

RADIATION LEAK

2 posted on 01/27/2005 2:55:03 PM PST by So Cal Rocket (Proud Member: Internet Pajama Wearers for Truth)
[ Post Reply | Private Reply | To 1 | View Replies]

To: Constitutionalist Conservative

public static string GetRandomMessage()
{
string [] Messages = {
"BUZZ OFF",
"TOUCH ME",
"STEP AWAY",
"SET TO STUN",
"SCORE = 3413",
"PAT EATS MICE",
"FEED ME",
"GO AWAY",
"NEED MORE SPACE",
"POUR ME A DRINK",
"IN DISTRESS",
"NICE SHIRT",
"GO AWAY",
"NO PRINT FOR YOU",
"RADIATION LEAK",
"HANDS UP",
"PRESS MY BUTTON",
"TAKE ME HOME",
"LOOKS LIKE RAIN",
"HELLO WORLD",
"NICE HAIR",
"NEED A MINT?",
"BE GENTLE",
"BE KIND",
"INSERT DISK",
"BUY ME LUNCH",
"DONT STOP",
"COME CLOSER",
"TAKE A BREAK",
"INSERT QUARTER",
"BLACK SABBATH"
};


Random r = new Random();
return Messages[r.Next() % Messages.Length];
}


3 posted on 01/27/2005 3:24:36 PM PST by demlosers
[ Post Reply | Private Reply | To 1 | View Replies]

To: Constitutionalist Conservative

Very funny ;-)


4 posted on 01/27/2005 3:59:27 PM PST by Bush2000
[ Post Reply | Private Reply | To 1 | View Replies]

Disclaimer: Opinions posted on Free Republic are those of the individual posters and do not necessarily represent the opinion of Free Republic or its management. All materials posted herein are protected by copyright law and the exemption for fair use of copyrighted works.

Free Republic
Browse · Search
General/Chat
Topics · Post Article

FreeRepublic, LLC, PO BOX 9771, FRESNO, CA 93794
FreeRepublic.com is powered by software copyright 2000-2008 John Robinson