Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: The behavior of Win32::OLE->new

by l3nz (Friar)
on Nov 19, 2003 at 17:31 UTC ( [id://308352]=note: print w/replies, xml ) Need Help??


in reply to The behavior of Win32::OLE->new

This is not much a Perl-ish answer, but I guess it's not mostly a Perl problem - this is probably because of the threading model the object is running under. I have come across the same problem with VisualBasic and JavaScript object creation, and I have found that, to obtain different and separate independent copies, you can:
  • Create an object of type WScript.Shell
  • Call the "run" method on it to launch a separate browser (or whatever program you need to run)
This is a sample, just not to go completely off-topic and being thrown out of the monastery for messing with the Enemy without providing appropriate Perl code as an offer:
use Win32::OLE; my $url = 'http://www.perlmonks.com/index.pl?node_id='; # opens five separate instances for (my $i = 0; $i < 5; $i++ ) { my $node_id = 300000 + $i; $obSh = Win32::OLE->new('WScript.Shell'); $rc = $obSh->run("IEXPLORE.EXE ${url}${node_id}", 1, false); undef $obSh; }
On my Windows box, each copy of explorer is independent and separately prompts for the proxy password.

You might want to read this too.

Replies are listed 'Best First'.
Re: Re: The behavior of Win32::OLE->new
by marynella (Novice) on Nov 20, 2003 at 15:37 UTC
      Your solution maybe good, but I have another problem. Maybe someone had this new problem to and can help me.
    I've put in my script the line:
      $obSh = Win32::OLE->new('WScript.Shell', sub {$_[0]->Quit;}) or die "Can't start Shell", Win32::OLE::LastError();
    This line gives me an error:
      Can't start ShellWin32::OLE(0.17) error 0x80040154: "Class not registered"
    Thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://308352]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-16 20:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found