Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hey,
I've been trying to get the code shown below to work on NT, and it's driving me nuts. It works flawlessly on Win2k, but not on NT 4.0. The GetActiveObject does not seem to return anything, even when several copies of IE may be running. I've searched thru the ActiveState mailing lists, etc, but I can't find any solution or workaround for the problem. Any ideas?
Thanks,
chinman
#!/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"); } } }

In reply to Win32::OLE-GetActiveObject by chinman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-03-28 14:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found