use strict; use Getopt::Long; use Win32::OLE qw( EVENTS with in ); use Win32::OLE::Variant; use Win32::OLE::Enum; ################################################################################ # Enumerated IE Values ################################################################################ use constant OLECMDID_PRINT => 6; use constant OLECMDID_SAVE => 3; use constant OLECMDID_SAVEAS => 4; use constant OLECMDID_OPEN => 1; use constant OLECMDEXECOPT_DEFAULT => 0; use constant OLECMDEXECOPT_PROMPTUSER => 1; use constant OLECMDEXECOPT_DONTPROMPTUSER => 2; ################################################################################ # Option Variable Declaration ################################################################################ my %args; ################################################################################ # Process Command Line Options ################################################################################ GetOptions( \%args, "help!" => sub { f_usage() }, ); ################################################################################ # Global Variable Declaration and Setting ################################################################################ my $Application = "InternetExplorer.Application"; $| = 1; ################################################################################ # Function Declaration ################################################################################ sub f_usage { print "Usage: " . __FILE__ . "\n"; exit 0; } ################################################################################ # Main Process ################################################################################ my $IE = Win32::OLE->new( $Application ) || die "$0: Could not start: $Application - $@, $!\n"; $IE->{Visible} = 1; while ( ) { chomp; $IE->Navigate( $_ ); while ( $IE->Busy() ) { sleep 2; } $IE->ExecWB( OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER ); sleep 5; while ( $IE->Busy() ) { sleep 2; } } $IE->Quit(); exit; __DATA__ my.yahoo.com