Long story short, I'm trying to write an advanced command prompt. Some of the programs will be launched from the GUI I created (which resembles the DOS prompt), and some of them will be user-interactive, with their output streamed into a text box and the input taken from either the keyboard or another text box below it.
The problem is, when I got the program to interact, output-only functions like "dir" worked perfectly, but other ones, like "prompt" which required input, would freeze the program and really mess up the processor. Any suggestions?
$foo = Run(@ComSpec & " /c " & $data, $currentdir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
do
;; run
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
if $line <> "" Then GUICtrlSetData($txtMain, $line, "add")
;MsgBox(0, "STDOUT read:", $line)
Wend
if not WinExists($foo) then ExitLoop
do
$msg = GUIGetMsg()
until $msg = $button1
MsgBox(0,"","Writing OUT")
StdinWrite($foo, GUICtrlRead($txtPrompt)& @CRLF)
StdinWrite($foo)
until not WinExists($foo)