Sign in to follow this  
Followers 0
RobertKipling

Stream input and output (at the same time)

3 posts in this topic

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)

Share this post


Link to post
Share on other sites



Can you show some code we can run to see the problem?


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Here's the source code for the project; sorry I didn't include it earlier but it's a lot of content.

prompt.zip

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0