Nesh has asked for the wisdom of the Perl Monks concerning the following question:
I came up with thisFunction ExecSyncStep(stepName) Dim WshShell, oExec Set WshShell = CreateObject("WScript.Shell") Set oExec = WshShell.Exec(stepName) Dim ouputStream ouputStream = "" Do While oExec.Status = 0 Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop WScript.Sleep 100 Loop Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop Set ExecSyncStep = oExec End Function
Please advise.#Returns the status object of the sync process $oExec; $oExec = system($stepName); $ouputStream = ""; while($? eq 0){ Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop sleep 100; } Do While Not oExec.StdOut.AtEndOfStream ouputStream = ouputStream & oExec.StdOut.ReadAll Loop #WScript.StdOut.Write ouputStream return $oExec; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to check a executable's status while running it.
by dragonchild (Archbishop) on Apr 18, 2005 at 19:02 UTC | |
by ikegami (Patriarch) on Apr 18, 2005 at 19:25 UTC | |
by Nesh (Beadle) on Apr 18, 2005 at 19:20 UTC | |
by dragonchild (Archbishop) on Apr 18, 2005 at 19:28 UTC |