Console output

BlitzMax Forums/BlitzMax Programming/Console output

MacSven(Posted 2007) [#1]
Can i use from an external program that runs in the Terminal (MacOS X) the Textoutput, Status Info etc. in my own Blitzmax GUI like this:

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9702
avrdude: current erase-rewrite cycle count is 1 (if being tracked)
avrdude: reading flash memory:

Reading | ################# | 33% 9.25s

or not?


FlameDuck(Posted 2007) [#2]
Erm, yes? Look at the various pipes that are contained in the TProcess object.


MacSven(Posted 2007) [#3]
Where can i find the TProcess object? I can't fin anything in the Blitzmax manual.


MacSven(Posted 2007) [#4]
Has anybody a sample?


Pantheon(Posted 2007) [#5]
If memory serves me then the TProcess stuff is in the public source folder below all the documentation (in normal IDE).
One of the problems that i can see you having is setting the cursor to overwrite the progress bar when theres an update. I havent seen a way to do this yet but with a bit of web searching you should be able to find it.

Im sorry but I dont think I fully understand the details of your question but I hope that I helped anyway :)


klepto2(Posted 2007) [#6]
this is a small function from a 'ModuleManager' I'm currently writing (to get my head a bit free from minib3d)



Maybe this will help you.


MacSven(Posted 2007) [#7]
Yes, this is the beginning. I hope it will be not to late this night.


MacSven(Posted 2007) [#8]
This Part is done. Work's great with the code examples from klepto2.
I have now another question to all. Is it possible to make a incbin with an external programm and can i start it from my blitzmax main program.
My idea is now to use the terminal execution in my blitmax main and start it
so that i have only one program file?


klepto2(Posted 2007) [#9]
Short and simply : with some restrictions yes:

I have written a sample app for something like this to provide
extended error info for apps (mainly usage in betas)

here is a sample: http://www.blitzforum.de/upload/file.php?id=518

the main program is the test.bmx and have to be compiled at first (in this case with debug enabled)

after this you compile the exdebugger.bmx. (release mode)

Now simply execute exdebugger.exe and you will see the result. The trick behind this is to temporaly recreate the test.debug.exe by copying the bin data from the incbin stream to the HD and create a process attached to this temp.exe.


Vertex(Posted 2007) [#10]
Interesting! It is possible to do the following?:
There are 1 master and 3 slaves.
I wan't that the master can start the 3 slaves as processes(CreateProcess) and communicate(read and write data from/to slave)
But the slaves may not wait for any input(so, there is no way I think with Input command) and the master too. So I need a function, to check, if there are StdIn stuff available.

I hope you have an idea :)

cu olli


MacSven(Posted 2007) [#11]
I have tested another form to start an external programm under MacOS X. I copied the file directly into to the applicationdir that is shown in contextmenu "Show Package". And it work's.


MacSven(Posted 2007) [#12]
I used this program part for my GUI project. It shows me all info's about the external program. But it has a counter that show's me the percent of the program status, but i get this errormassage from BlitzMax:

PipeStream ReadBuffer Overflow
Process complete

In the c-source it print out the following:

if (last == 0) {
fprintf(stderr, "\r%s %d%% %0.2fs ",
header, percent, etime);
}

This is the code i use in Blitzmax:

While Process.Status()
PollSystem
If Process.pipe.ReadAvail() Then
line = Process.pipe.ReadLine()
If line <> "" Then
AddTextAreaText(textarea , line+Chr$(13))
FormatTextAreaText(textarea,10,230,460,70,lines,1,TEXTAREA_LINES)
lines=lines+1
EndIf
EndIf
If Process.err.ReadAvail() Then
line = Process.err.ReadLine()
If Line <> "" Then
AddTextAreaText(textarea , line+Chr$(13))
FormatTextAreaText(textarea,10,230,460,70,lines,1,TEXTAREA_LINES)
Lines=lines+1
EndIf
EndIf
Wend