CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Learning PERL- would like preprogramming guidance automating my computer

 



sunburn
New User

Mar 10, 2011, 5:34 PM

Post #1 of 5 (1715 views)
Learning PERL- would like preprogramming guidance automating my computer Can't Post

Ok, I'm new to PERL so before I get to in depth in learning, I want to make sure I can do what I want to do. I've been programming in "AUTOIT" and doing ok but got lost as my programs got longer. I found I was completely reliant on some modules that I didn't know how to get around as my browser and system kept getting updated. What I'd like is someone to check out what I'd like to do and maybe suggest the modules or functions that would be good to use. I'm halfway through the book "beginning perl" so I'm doing my best to become less of a nub.

In essense I want to automate my computer to log onto my company website where adhoc jobs are posted.
Querry it every 4 or 5 minutes and see if something new is open. I need to send some parts of webpage to an OCR program (they present pictoral descriptions sometimes rather than HTML). Categorize and filter the information based on job type and dates. Finally I need to send it via email for my notification. The entire purpose is because these jobs go out first come first served and I simply cant sit in front of the computer 24/7..... Well thats the program here is what I want comments on...

Is it best to automate Internet explorer? Chrome? or Modzilla? and which set of modules would be best allinclusive that I should research for this.

Can I easily capture part of a page as a picture to send to an OCR? again what modules would work best

I've got to send that email notification, currently I have a google account, but I'm willing to set up whatever I need to make this happen. again what modules would work best
As a convenience I'd like to put my inputs/ passwords and filters in through a GUI at start up of automation, so any ideas on GUI builders would be nice.

I know if these four areas can be surmounted easily then I'll not be wasting my time. Thanks for the comments and helping make sure I'm on the right language. Any snipets of code that come to mind would be so helpful as well. I'm sure all this has been done before, but I'm really lost searching the vast perl archives.... I'd love to get a "Mentor" to help me through this process or maybe even someone for hire who can help me get the basic framework down. Please email me privately for those responses.


Karazam
User

Mar 10, 2011, 11:00 PM

Post #2 of 5 (1706 views)
Re: [sunburn] Learning PERL- would like preprogramming guidance automating my computer [In reply to] Can't Post

For logging into websites and fetching stuff you will want to have a look at the LWP family of modules,
like LWP::Simple, LWP::UserAgent. WWW::Mechanize is also very useful.

For sending mail there's for example MIME::Lite.

Turning web-content into picture -- I have no experience with that, but I saw some example code to do that
on WWW::Mechanize::Firefox::Examples at cpan.org.

That seems to be one example of actually automating a browser, that's not normally something you need to do.
Stuff like logging in and fetching things are done by Perl alone. If you know where the pictures you need to run
through OCR are located on the web page you can just get them through normal means and send them to your
OCR program. Probably a much easier/less errorprone method.

A final note -- it's not PERL, but Perl (it's not an acronym).

Hope this helps somewhat. Smile


(This post was edited by Karazam on Mar 11, 2011, 12:43 AM)


sunburn
New User

Mar 11, 2011, 1:59 PM

Post #3 of 5 (1695 views)
Re: [Karazam] Learning PERL- would like preprogramming guidance automating my computer [In reply to] Can't Post

Hmm, Not actually using the browser to find stuff... That would be AWESOME ... Thats where all my problems were coming from in AUTO IT. Everything would bog down because of the browser (IE) useage.. Any snippets that someone has specifically of this (and filling in form data) would help get me started (or known links to the forum...) I'm so overwhelmed as I look through all the material available so please keep chiming in with ideas.

The current pictures that I was talking about are posted as .gif's but they were not compatible for whatever reason when I tried calling various OCR programs. Ive been reading about the Tesseract as a good construct, but it takes .TIFF

once again a snippent of someone calling the Teseract or other free OCR with the appropriate files would be extremely enlightening.

Humble appologies to everyone about the Perl vs PERL gaff.....


Karazam
User

Mar 12, 2011, 6:09 AM

Post #4 of 5 (1686 views)
Re: [sunburn] Learning PERL- would like preprogramming guidance automating my computer [In reply to] Can't Post

Just getting a webpage is real easy:


Code
use LWP::Simple; 
$doc = get('http://www.example.com');


Getting an image:


Code
use LWP::Simple; 
my $pic = get('http://imgs.xkcd.com/comics/regular_expressions.png');
open my $fh, '>', 'regex.png';
print $fh $pic;


With the following code I was able to log in to this forum:


Code
#!/usr/bin/perl 
use warnings;
use strict;

use LWP::UserAgent;
use HTTP::Request::Common qw(POST);

my $ua = LWP::UserAgent->new;
my $request = POST 'http://perlguru.com/gforum.cgi?do=login',
[ login_username => 'nope', login_password => 'secret' ];
my $respond = $ua->request($request);

if ( $respond->is_success ) {
print $respond->content;
}
else {
print $respond->status_line . "\n";
}


Check the documentation for the LWP modules at cpan.org for more.
There's also a cookbook: http://search.cpan.org/~gaas/libwww-perl/lwpcook.pod

If you need to convert images programatically there's ImageMagick (http://www.imagemagick.org/script/index.php) which has a Perl API.

Calling an external program from a Perl script can be done done with the "system" command. Borrowing from Tesseract's ReadMe, that's


Code
system "tesseract image.tiff outputbasename";


Hope this helps. Smile


(This post was edited by Karazam on Mar 12, 2011, 6:10 AM)


sunburn
New User

Mar 12, 2011, 10:23 PM

Post #5 of 5 (1678 views)
Re: [Karazam] Learning PERL- would like preprogramming guidance automating my computer [In reply to] Can't Post

Thanks Karazam! This is going to take me awhile to battle through, so I might bump in a few weeks with questions... Cheers!
Sunburn

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives