• Welcome to Theos PowerBasic Museum 2017.

IWshExec.Status Property

Started by José Roca, July 14, 2008, 10:16:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code runs calc.exe and echoes the final status to the screen.

JScript

var WshShell = new ActiveXObject("WScript.Shell");
var oExec = WshShell.Exec("calc");
while (oExec.Status == 0)
{
    WScript.Sleep(100);
}
WScript.Echo(oExec.Status);


VBScript

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec("calc")
Do While oExec.Status = 0
    WScript.Sleep 100
Loop
WScript.Echo oExec.Status


PowerBASIC

DIM pWsh3 AS IWshShell3
DIM pWshExec AS IWshExec
pWsh3 = NEWCOM "WScript.Shell"
pWshExec = pWsh3.Exec(UCODE$("calc"))
DO
  IF pWshExec.Status <> 0 THEN EXIT DO
  SLEEP 100
LOOP
PRINT "Status: " pWshExec.Status