Geeks With Blogs
Garrett Hoofman ..:: visions of afar ::..

I saw a post on Digg today about changing the Ready message on the screen of your HP Printers. So I took a look at it and modified it so that it will read the XML output of the Google weather service. Just change the IP address to that of your HP Printer and then set it up as a scheduled task. Then change the Google URL to your location.

http://www.google.com/ig/api?weather=      03051     &hl=en

If you ever want to know how cold it is outside, take a look at your printer.

 

#!/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 the
  # command line. 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/ )
  #
  # Modified by Garrett Hoofman
  # 10/18/2007
  # http://www.visionsofafar.com

use strict;
use warnings;
use XML::DOM;

 

 

 

my $file = 'http://www.google.com/ig/api?weather=03051&hl=en';

my $peeraddr = "192.168.83.4";

 

 


my $rdymsg = "Ready";

my $parser = XML::DOM::Parser->new();
my $doc = $parser->parsefile($file);

foreach my $species ($doc->getElementsByTagName('current_conditions')){
  $rdymsg = $species->getElementsByTagName('temp_f')->item(0)
            ->getAttribute('data') . " Degrees Out      " . $species->getElementsByTagName('condition')->item(0)
            ->getAttribute('data');
  print "\n";
}

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

print $socket $data;

Posted on Thursday, October 18, 2007 3:16 PM | Back to top


Comments on this post: Perl Weather Script for HP Printers

# re: Perl Weather Script for HP Printers
Requesting Gravatar...
I'd like to try the script but I keep receiving the error "Can't find string terminator EOJ anywhere before EOF" when I run it. Do you have any guidance on how to get past it?
Left by Hal on Dec 09, 2007 1:40 PM

# re: Perl Weather Script for HP Printers
Requesting Gravatar...
The EOJ must start in the first column and be the only thing on the line. There is a space in the listing.

--Yaakov
Left by Yaakov on Jun 12, 2008 3:22 PM

# re: Perl Weather Script for HP Printers
Requesting Gravatar...
I cant get this to work for the life of me. It just errors.. Can't locate XML/DOM.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib .) I have attempted to install the XML::DOM plugin through the perl shell and it looks like it tries to install but ends with a make install error. I also installed the latest version of perl. Some guidance would be helpful.
Left by SixPack on Oct 07, 2008 10:45 AM

# This website owner claims he discovered great affiliate websites
Requesting Gravatar...
So previous month I was thinking about starting my own affiliate marketing business and to obtain any affiliate websites I just don't know if it is better to build one myself or obtain any already turnkey affiliate marketing websites. I just discovered website
website affiliate and here was two reviews about these sites but I still haven't made decision what to do. Maybe here some people who can give some opinion about websites reviewed at that site?
http://www.home-businessreviews.com/Turnkey-Affiliate-Websites.html
Left by Utinvaria on Oct 26, 2009 5:53 PM

# Turnkey Affiliate websites is it worth to purchase them
Requesting Gravatar...
Maybe memebers know what are good benefits of buying affiliate websites? previous month I'm considering to purchase one? Can anyone have opinion of some good website to read any more reviews or opinions which site can produce large income? I found this site
affiliate websites - owner told that he had very good success using these affiliate marketing websites. He wrote that he earns thousands of cash every month with these sites. Waiting for any reply.
that is site I 'm talking
http://www.home-businessreviews.com/Turnkey-Affiliate-Websites.html
Left by affiliate websites on Nov 05, 2009 5:53 PM

# Read excellent work at home based business opportunity - earn 500$+/day
Requesting Gravatar...
Hi, I now became a member of this community here and I would love to be a member of it. Just enjoy the environment here. Good work by the mods and each member here.

I appreciate the quality of messages provided by everyone and expect I can do that for you all too. Just to start off, I found a great site called
internet home business opportunity that reviews some cool work at home based business opportunity. Anyway website owner earn's more than 500$+/day. He discovered some very great best home business opportunity.

Because I found that these home business Opportunities worked for me I decided to post it here so you also can make some extra bucks in your free time. Owner of this site also discovered very simple opportunity get some extra money just taking surveys for money. Anyway if you need to earn some extra money feel free to check out this site. Hope you guys enjoy it.

Anyway, look forward to great conversation and hanging out here often.
www.home-businessreviews.com
Left by almomeMycle on Nov 30, 2009 5:42 PM

# amazing xrumer service available here post your marketing message to thousands of blogs and forums
Requesting Gravatar...
Get great online web traffic using amazing xrumer service blast available. We are able post your marketing post to thousands of forums around the web, get insane amount of backlinks great online web traffic in very short time.
xrumer service

http://xrumerservice.weebly.com
Left by Kneebrode on Dec 02, 2009 5:11 AM

# Read excellent home based business reviews - make 500$+/day
Requesting Gravatar...
recently I was surfing web and suddenly I came across website named www.home-businessreviews.com I learned how to start my own home business and i was able at last quit my work where i worked one year, now I'm earning up to 5K USD month. I was able to make such kind of cash because I discovered some really cool home business reviews. At site called www.home-businessreviews.com

Anyway seems that site owner at last Came across winner online business program which helped him to start his own home based business, so he eventually decided to set up site and tell about his own experience about making money online. It seems that he lost thousands of dollars before he found winner home business program which actually helped to make money online. But which one? Find out at website below!
home business reviews
Left by bomospuro on Dec 05, 2009 6:54 AM

# Xrumerservice.weebly.com we are able to post your custom message to 100K blogs and wikis using xrumer
Requesting Gravatar...
Get large online web traffic using amazing xrumer service available. We are able post your custom message to thousands of forums around the web, get insane amount of backlinks incredible online web traffic in very short time.
xrumer

http://xrumerservice.weebly.com
Left by Kneebrode on Dec 05, 2009 3:06 PM

# Weird Video… Have You Seen This Girl?
Requesting Gravatar...
Ok, this is kind of weird but I just ran across this YouTube video: Kesha Tik Tok

It's a chick who calls herself Ke$ha (Yes that's Kesha with a dollar sign lol) But she's got this music video called Tic Toc and the lyrics and song are funny. It's kind of a good song believe it or not. At one point she says something like "I brush my teeth with a bottle of Jack…" obviously has a drinking problem. Either way watch it and let me know what you think of it. Like it or hate it?

…And is it weird that I got it stuck in my head? :-)
Left by Ontoniaemaity on Dec 06, 2009 6:45 AM

# Blog Success Any Good
Requesting Gravatar...
I'd like to ask if anyone may have read this blog success review? I've heard good things about the site, but it doesn't seem to be that known to many people?

The guy who did the report is also offering a blog success bonus that seems pretty good. Can anyone here tell me if it's worth it?

I'd love to make money on the web from writing a blog, as it seems like the right thing to do with my talents.
Left by dreddemyjoino on Dec 07, 2009 5:20 PM

# Is Recruiting and Staffing from home lucrative?
Requesting Gravatar...
Does anyone heard anything about staffing with this company recruiter I have been looking other companies that offer homebased positions. If anyone has advise about this please help....

Possibly someone can post me back quickly to help me make decision. Thank you
Left by anindizaphype on Dec 10, 2009 9:03 AM

# Great Information
Requesting Gravatar...
Thanks for this info. Additional discussions similar to this topic can be found at the World's Largest Forum.
Left by membroogs on Dec 10, 2009 3:24 PM

# Excellent Farmville Fansite. Get Free cheats and bots for your farm
Requesting Gravatar...
Hello members Are you obsessed to Farmville? I’ve discovered this great site that has all the latest hints, tips, tricks and cheats here:
Farmville Cheats I was struggling on Farmville and couldn’t understand how all my neighbors were doing so much better than me, but then I found this site and since then I’ve become a way more valuable farmer. The site has some Farmville cheats that I haven’t found anywhere else and has a great store where you can get the most up to date bots for Farmville. I’ve also noticed they have started competitions where you can win the bots and stuff and it is completely free to enter. If you are dependent to Farmville like me then you need to visit this site Farmville Tips
Left by poeguadoaxoca on Dec 21, 2009 12:32 PM

# PR10 - 9 - 8 -7 -6 -5 Backlinks
Requesting Gravatar...
Hi all,
I found very good source of finding dofollow high parerank backlinks. Even from real PR10.
I cant imagine value of a real pr10.

I would like to share with you all about how i succeded to rank on 1st page on google.
prseo@hotmail.com
http://Www.playhitmusics.com
Left by speenuespeene on Mar 12, 2010 6:28 AM

Your comment:
 (will show your gravatar)


Copyright © Garrett Hoofman | Powered by: GeeksWithBlogs.net