Yipee!!! Got it! Although, I don't understand the difference between how I created these to instances but I works-- thanks Steve!
This works: CreateObject OLE "InternetExplorer.Application" This doesn't work: Win32::OLE->new("InternetExplorer.Application", \&quit) I hope anyone who needs to know how to do this find this thread too since Google doesn't return much when you search for: +execScript +OLE +Perl : D Michael Perl Application #!C:\Perl\bin\perl #use Win32::OLE; use Data::Dumper; use OLE; # $ie = Win32::OLE->new("InternetExplorer.Application", \&quit) $ie = CreateObject OLE "InternetExplorer.Application" || die "FATAL ERROR - Failed to create instance of Internet Explorer!"; $ie->{left} = 0; $ie->{top} = 0; $ie->{width} = 300; $ie->{height} = 300; $ie->Navigate("http://localhost/index.php"); while ( $ie->{busy} ) { $ie->{visible} = 0; } $ie->{visible} = 1; $ie->Document->parentWindow->execScript('Hello()', 'JavaScript'); sub quit { my ($object) = @_; $object->Close(); } # sub ----- Original Message ----- From: "Enye Software" <[EMAIL PROTECTED]> To: "Steve Combs" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: "Werner Mathis" <[EMAIL PROTECTED]>; "Enye Software" <[EMAIL PROTECTED]> Sent: Thursday, April 11, 2002 8:14 PM Subject: Re: Perl-Win32-Web digest, Vol 1 #679 - 9 msgs > Rats! Still no go. $ie->Document->parentWindow is undefined. BTW, I'm using > IE6. Here's the code. Any help would be greatly appreciated! > > Michael % ) > > HTML Document > <html> > > <head> > <script language="JavaScript"> > function Hello() { alert('Hello World!'); } > </script> > </head> > > <body> > <a href="JavaScript:Hello()">Hello World!</a> > </body> > > </html> > > Perl Application > #!C:\Perl\bin\perl > > use Win32::OLE; > use Data::Dumper; > > $ie = Win32::OLE->new("InternetExplorer.Application", \&quit) > || > die "FATAL ERROR - Failed to create instance of Internet Explorer!"; > > $ie->{left} = 0; > $ie->{top} = 0; > $ie->{width} = 300; > $ie->{height} = 300; > > $ie->Navigate("http://localhost/index.php"); > > while ( $ie->{busy} ) { $ie->{visible} = 0; } > > $ie->{visible} = 1; > > $dmp = Data::Dumper->new([$ie->Document->parentWindow]); > > if (open(DMP,"+>admin.dmp")) { > print DMP $dmp->Dump; > close(DMP); > } # if > > sub quit > { > my ($object) = @_; > $object->Close(); > } # sub > > > ----- Original Message ----- > From: "Steve Combs" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Thursday, April 11, 2002 7:19 PM > Subject: RE: Perl-Win32-Web digest, Vol 1 #679 - 9 msgs > > > > I was intrigued and took note of this when it was asked and > > answered a couple of months ago. Try this set of archives: > > > http://aspn.activestate.com/ASPN/search?query=calling+javascript+from+within > > +perl&type=Archive_perl-win32-web > > > > --Steve > > > > > > > Reply-To: "Enye Software" <[EMAIL PROTECTED]> > > > From: "Enye Software" <[EMAIL PROTECTED]> > > > To: <[EMAIL PROTECTED]> > > > Subject: Executing JavaScript via OLE > > > Date: Thu, 11 Apr 2002 09:36:06 -0000 > > > Organization: Enye Software > > > > > > Hi, > > > > > > I am trying to call a JavaScript function from a Perl Win32::GUI > > > application that automates Internet Explorer using Win32::OLE by > > > creating an instance of the InternetExplorer object. Basically, I am > > > trying to execute or call a JavaScript script function so that I can > > > remotely control the web page. > > > .... > > > > > > Thank you in advance. > > > > > > Michael > > > > > > _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs