StdIn Property |
Description
Exposes the stdin input stream of the IWshExec interface.
PowerBASIC Syntax
Return Value
IDispatch. Reference to a ITextStream interface.
Remarks
Use the StdIn property to pass data to a process started using Exec.
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) DO IF pWshExec.Status = 1 THEN EXIT DO SLEEP 100 LOOP
|