capturing bmk.exe output to my app

BlitzMax Forums/BlitzMax Programming/capturing bmk.exe output to my app

col(Posted 2012) [#1]
Hiya all,

Typically bmk.exe when used via the command line spits out any info to that command line window. In my windowed Bmax app, I can invoke bmk.exe and see the output in the console window ( when I'm not using gui build ), but is there a way I can easily capture that info so I can use it as a string in my windowed app built as a gui build?

I'm invoking it via system_
Maybe a different MS Windows function?

Cheers


jsp(Posted 2012) [#2]
Use TProcess, here is a snippet:
				Proc:TProcess=TProcess.create(t$,True)
				If Proc Then	
						Local tmpTimeout:Int =MilliSecs() + 5000
						Repeat
						   errcode:String =Proc.err.ReadLine()
						   outcode:String =Proc.pipe.ReadLine()
							If outcode SetGadgetText(lblOutput ,"Info -> "+outcode )
							If errcode SetGadgetText(lblOutput ,"Error -> "+errcode )
							Delay 1
						Until (Not Proc.status()) Or (MilliSecs() > tmpTimeout)
						Proc.Close()
						Proc.Terminate()
					Proc=Null
				Else
					Notify "Process Failure~nCheck path and executable: "+t$
				End If



col(Posted 2012) [#3]
Superb!!

Thanks jsp.