Page 1 of 1
Running a Batch file and having it output in ritchtextbox
Posted: Thu Mar 07, 2013 11:16 pm
by skyteam
Hi guys so I need help I've looked online with no luck
so the code needs to open the batch then hide it and send the out put to the richtextbox
thanks tim
~~~~~~~~~~~~~~~~~~~~~~~~~~edit~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I got it to work but now It will not launch the python part of the batch :3
Re: Running a Batch file and having it output in ritchtextbox
Posted: Fri Mar 08, 2013 12:19 am
by Scottie1972
Code: Select all Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
p = New Process
p.StartInfo.FileName = "application.exe"
p.StartInfo.UseShellExecute = False
p.StartInfo.RedirectStandardOutput = True
p.StartInfo.RedirectStandardError = True
p.StartInfo.CreateNoWindow = False
AddHandler p.OutputDataReceived, AddressOf p_OutputDataReceived
p.Start()
p.BeginOutputReadLine()
End Sub
Public Sub p_OutputDataReceived(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
UpdateTextBox(e.Data)
End Sub
Delegate Sub SetTextCallback([text] As String)
Private Sub UpdateTextBox(ByVal text As String)
If Me.TextBox1.InvokeRequired Then
Dim d As New SetTextCallback(AddressOf UpdateTextBox)
Me.Invoke(d, New Object() {text})
Else
If TextBox1.Text = Nothing Then TextBox1.Text = text Else TextBox1.AppendText(vbNewLine & text)
End If
End Sub
Example-Catch BatchFile Output.zip
Re: Running a Batch file and having it output in ritchtextbox
Posted: Fri Mar 08, 2013 12:45 am
by skyteam
I have that thing is it wont run python scrips for some reason
here's my batch file
"C:\Python32\python.exe" launch.py
"C:\Python32\python.exe" start.py <--- if theres an error then
del /Q start.py <----- this happens
del /Q bot_conf.py
yet it doesnt work
Re: Running a Batch file and having it output in ritchtextbox
Posted: Fri Mar 08, 2013 12:47 am
by Scottie1972
skyteam wrote:I have that thing is it wont run python scrips for some reason
why are you running python scripts on a windows pc?
Did you SET the ENVIROMENTVARABLE for window to the PERL.exe path?
Code: Select allIn short, your path is:
My Computer ‣ Properties ‣ Advanced ‣ Environment Variables
In this dialog, you can add or modify User and System variables. To change System variables, you need non-restricted access to your machine (i.e. Administrator rights).
Another way of adding variables to your environment is using the set command:
set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
To make this setting permanent, you could add the corresponding command line to your autoexec.bat. msconfig is a graphical interface to this file.
Viewing environment variables can also be done more straight-forward: The command prompt will expand strings wrapped into percent signs automatically:
echo %PATH%
Do you have this line
in the .pl script set to the path of your perl install folder?
Did you add the
ECHO statement to the .bat file?
Re: Running a Batch file and having it output in ritchtextbox
Posted: Fri Mar 08, 2013 12:54 am
by skyteam
Scottie1972 wrote:skyteam wrote:I have that thing is it wont run python scrips for some reason
why are you running python scripts on a windows pc?
because its for my chatango bot it works fine till I try to add that batch file and since all the python gui suck monkie nuts Id like to make it in vb