pawcio has asked for the wisdom of the Perl Monks concerning the following question:

Hello mates. I wonder what is the best way to run IE and wait until I close his window? I was trying with Win32::Process::Create, unfortunately without success bicouse explorer creates subproccess (iexplorer) and I don't know how to wait for his exit. Cheers, Patience Monks

Replies are listed 'Best First'.
Re: run IE and wait until his close
by thor (Priest) on Sep 28, 2005 at 23:53 UTC
    I don't have a windows machine handy right now, but what about:
    my $status = system('iexplore');

    thor

    Feel the white light, the light within
    Be your own disciple, fan the sparks of will
    For all of us waiting, your kingdom will come

      To finish what Thor just said:
      * update *
      Changed qx to sytsem after thor's comment. It can indeed be done in more ways, but then again, that's Perl :-)
      use strict; my $status = system('C:/PROGRA~1/INTERN~1/IEXPLORE.EXE'); print "Done with ie! after system\n"; my $ieStdOut= qx('C:/PROGRA~1/INTERN~1/IEXPLORE.EXE'); print "Done with ie! after qx\n"; my $ieStdOut= `C:/PROGRA~1/INTERN~1/IEXPLORE.EXE`; print "Done with ie! after backticks\n";
      As soon as ie quits, the next line of code is executed.

      "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
        qx and system are not equivalent; qx and backticks are, though. In your code snippet, the (inappropriately named) $status will contain whatever is output to standard out by internet explorer. Other than that, though, it should work. :)

        thor

        Feel the white light, the light within
        Be your own disciple, fan the sparks of will
        For all of us waiting, your kingdom will come

Re: run IE and wait until his close
by ikegami (Patriarch) on Sep 29, 2005 at 05:16 UTC

    In you still wish to use Win32::Process, use the Wait method:

    Win32::Process::Create($ie, ...) or die("..."); $ie->Wait(INFINITE);
Re: run IE and wait until his close
by GrandFather (Saint) on Sep 28, 2005 at 23:53 UTC

    What code have you tried?


    Perl is Huffman encoded by design.
Re: run IE and wait until his close
by pawcio (Initiate) on Sep 29, 2005 at 19:28 UTC
    Trouble is that I would like to start explorer with url like parameter no iexplore with parameter. The question is: How to wait infinite for sub proccess or for process created by proccess?