Console output

BlitzMax Forums/BlitzMax Programming/Console output

this is a small function from a 'ModuleManager' I'm currently writing (to get my head a bit free from minib3d)

Function BuildModule(MName:String = "" , Opt:Int = 2)
	Local Exec:String = "bmk makemods "
	Select Opt
		Case 0
			Exec:+"-r "
		Case 1
			Exec:+"-d "
		Case 2
			Exec:+ "-a "
		Case 3
			
	End Select
	
	Local Process:TProcess = CreateProcess(Exec + MName,HideConsole)
		
	SetTextAreaText(Output,"")
	
	AddTextAreaText(Output , "Starting ...~n")
	AddTextAreaText(Output , Exec + MName+"~n")
	AddTextAreaText(Output , "Process Handle : " + Process.Handle + "~n"+"----------------------------------------------~n")
	RedrawGadget(OutPut)
	Local Lines:Int = 3
	Local ErrorMsg:String = ""
	While Process.Status()
		PollSystem

		If Process.Pipe.ReadAvail() Then
			Local Line:String = Process.Pipe.ReadLine().Trim()
			If Line <> "" Then
				AddTextAreaText(Output , Line + "~n")
				Lines:+1
			EndIf
		EndIf
		
		If Process.err.ReadAvail() Then
			Local Line:String = Process.err.ReadLine().Trim()
			If Line <> "" Then
				ErrorMsg:+Line+"~n"
				AddTextAreaText(Output , "Error : " + Line + "~n")
				Lines:+ 1
				FormatTextAreaText(Output,190,20,20,0,Lines,1,TEXTAREA_LINES)
			EndIf
		EndIf	
	
	Wend
	
	
	
	AddTextAreaText(Output , "~nProcess terminated")
	
	If ErrorMsg <> "" Then
		Notify(ErrorMsg)
	Else
		Notify("Build Succesfull!")
	EndIf

End Function


Maybe this will help you.