berntsmr has asked for the wisdom of the Perl Monks concerning the following question:
This is the version that prints all pages (rainforest not-so-friendly). Again - I want to know how to default this to just 1 page. Any and all help appreciated. -Michaeluse 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 ( <DATA> ) { 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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Controlling IE Printing from a Win32::OLE object
by planetscape (Chancellor) on May 26, 2006 at 04:04 UTC |