StdOut Property

 

Description

 

Exposes the write-only stdout output stream of the IWshExec interface.

 

PowerBASIC Syntax

 

PROPERTY GET StdOut () AS ITextStream

 

Return Value

 

IDispatch. Reference to a ITextStream interface.

 

Remarks

 

The StdOut property contains a read-only copy of any information the script may have sent to the standard output.

 

Example [PowerBASIC]

 

The following code starts a batch file and waits for the user input prompt. After entering the needed data through the StdIn stream, the batch file will be able to complete.

 

#INCLUDE "SCRRUN.INC"

#INCLUDE "WSHOM.INC"

 

DIM pWsh3 AS IWshShell3

DIM pWshExec AS IWshExec

DIM pStdIn AS ITextStream

DIM pStdOut AS ITextStream

DIM strInput AS STRING

 

pWsh3 = NEWCOM "WScript.Shell"

pWshExec = pWsh3.Exec(UCODE$("test.bat"))

pStdOut = pWshExec.StdOut

DO

   IF pStdOut.AtEndOfStream THEN EXIT DO

   strInput = strInput & ACODE$(pStdOut.Read(1))

   IF INSTR(strInput, "Press any key") <> 0 THEN EXIT DO

   SLEEP 100

LOOP

pStdIn = pWshExec.StdIn

pStdIn.Write UCODE$($CRLF)

pStdIn = NOTHING

DO

   IF pWshExec.Status = 1 THEN EXIT DO

   SLEEP 100

LOOP

 

Valid XHTML 1.0 Transitional