It does not seem to be working. Here is what I have:
Myshell.DataAvailable: Window1.outEdt.Text = Window1.outEdt.Text + " " + Me.ReadAll Myshell.Completed: Window1.StateLbl.Caption = "State: Complete" RunBtn.Action: Dim S As New Myshell S.Mode = 2 StateLbl.Caption = "State: Running" s.Execute "Writer" Writer writes the numbers 0 to 20 to stdout at .5 second intervals. When the Run button is clicked, StateLbl changes to "State: Running" but nothing else happens. It appears that neither Myshell event is firing. (I've put breaks in them which are never reached.) Paul Dobbs Software Engineer, Staff Lockheed Martin Missiles and Fire Control Phone (972) 603-1244 Fax (972) 603-2017 -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Jones Sent: Tuesday, April 18, 2006 11:01 AM To: REALbasic NUG Subject: Re: Stdin to app with gui Hi Paul, On Apr 18, 2006, at 8:43 AM, Dobbs, Paul wrote: > I have a simulation writtin in c++ running on Linux. It outputs a > series of status reports to stdout. I'd like to use a RB program to > display those reports in a window, reading stdin in a loop, parsing > the lines from stdin, and displaying the results in editfields or > statictexts. > > However, it appears to be impossible to use stdin or > StandardInputStream in a graphical RB program. Is this true, or have I > just not figured out how to do it? This is what the Shell is for. You can open an Interactive shell (Mode = 2), start your tool and monitor the Shell's DataAvailable and Completed Events to accept the data from the tool's stdout (and even send to the tool over stdin if needed) and display it however needed. Create a new Shell Class called myShell in your project Add an instance of myShell to your main window (now called myShell1 or you can rename it) Select the myShell1 instance and change the mode to 2 Check the Events for myShell1 and you will see the "DataAvailable" and "Completed" events. Add Code to the DataAvailable event to catch and process your tool's stdout output. Add Code to the Completed event that handles the tool's finishing and exiting In your main window, call myShell1.Execute "the tool command and args" This should get you what you're looking for unless your tool is running and you're trying to attach to it. In that case, you might try redirecting stdout to a file in your tool, using a Shell and executing "tail -f /tmp/the_stdout_file" as the Shell's command instead of your tool and then using the same info above. Tim _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html>
