chinman has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl -w use strict; my $file = 'C:\temp\index.html'; display_browser("$file"); ##subroutine that supposedly displays a file in IE browser window sub display_browser { my $file = shift; ## convert backslashes to forward slashes in the file path $file =~ s!\\!/!g; if ( $^O eq "MSWin32" and "$file" and -e "$file" ) { use Win32::OLE; ## test to see if internet explorer is already running my $ie = Win32::OLE->GetActiveObject('InternetExplorer.Applica +tion'); ## if ie is not running, launch it, yeah right! unless ( defined $ie ) { $ie = new Win32::OLE( 'InternetExplorer.Application', '' ) + or die "Yikes, can't launch Internet Explorer: $!"; } ## if we were successful in launching, make visible and naviga +te to the proper URL if ( defined $ie ) { $ie->{Visible} = 1; $ie->Navigate("$file"); } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32::OLE-GetActiveObject
by c-era (Curate) on Dec 06, 2001 at 00:43 UTC | |
by chinman (Monk) on Dec 06, 2001 at 03:58 UTC | |
by timgas (Initiate) on Feb 07, 2002 at 16:37 UTC | |
by Anonymous Monk on Aug 08, 2004 at 09:19 UTC |