use strict; use warnings; use Cwd; use Win32::Gui; use Win32::Clipboard; use Win32::GuiTest qw(:ALL); # Had to use GuiTest to do a sendkeys. Also found ShowWind-minimize method (don't use hide or you will never see the window again) use Win32::OLE; # need this to open up and IE window use Win32::OLE qw(EVENTS in with valof ); use Win32::OLE::Variant; Win32::OLE->Option( Warn => 2 ); # Always warn with verbose error messages # try to find all OLE objects my $Count = Win32::OLE->EnumAllObjects(sub { my $Object = shift; my $Class = Win32::OLE->QueryObjectType($Object); printf "# Object=%s Class=%s\n", $Object, $Class; }); print "---- The count of all OLE objects is '$Count'.\n"; my $loExcel; $loExcel = Win32::OLE->GetActiveObject('Excel.Application'); if ( defined $loExcel ) { print "Found Excel.\n"; } else { print "Did not find and Excel object. LastError=", Win32::OLE->LastError, "\n"}; my $IE; $IE = Win32::OLE->GetActiveObject( "InternetExplorer.Application" ); print "=== GetActiveObject for ie returns '$IE'\n\n" if ( defined $IE); if ( !defined $IE ) { print "Can not find open IE object. Creating one...\n"; # $IE = Win32::OLE->new( 'InternetExplorer.Application', "Quit" ) $IE = Win32::OLE->new( "InternetExplorer.Application" ) or die "Unable to create a IE Object\n"; ################ need logic in here to wait for window to open ############################## # Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2"); } #### ---- The count of all OLE objects is '0'. Found Excel. Can not find open IE object. Creating one... The current directory is H:/src/Perl. Url found from IE object 'file://H:\src\Perl\osmerrors1.html' is=file://H:/src/P erl/osmerrors1.html?5,now.