@Parth-Kurani said:
@gurikbal-singh Even when I set useShellExecute to false, the python script is still not being invoked. The txt file that my python script is supposed to generate cannot be found anywhere. Any advice on how to resolve this issue?
proc.StartInfo.Arguments = string.Concat(progToRun, " ", s)
try
{
Process Process = new Process();
string keyValues = currentDirectory() + "\\User_Command_Line_Tools_PATH";
string keyValue = currentDirectory() + "\\GnuWin32\\bin";
string envVar = Process.StartInfo.EnvironmentVariables["path"];
if (envVar != null)
{
string value = envVar + ";" + keyValue + ";" + keyValues;
Process.StartInfo.EnvironmentVariables["path"] = value;
}
else
{
Process.StartInfo.EnvironmentVariables.Add("path", keyValue);
Process.StartInfo.EnvironmentVariables.Add("path", keyValues);
}
Process.StartInfo.FileName = windir() + "\\cmd.exe";
Process.StartInfo.Arguments = "/c " + richTextBox1.Text;
if (filepath().ToString() == filex().ToString())
{
Process.StartInfo.WorkingDirectory = currentDirectory() + "\\GnuWin32\\bin";
}
else
{
Process.StartInfo.WorkingDirectory = path.ToString();
}
Process.StartInfo.RedirectStandardError = true;
Process.StartInfo.RedirectStandardOutput = true;
Process.StartInfo.RedirectStandardInput = true;
Process.StartInfo.UseShellExecute = false;
Process.StartInfo.CreateNoWindow = true;
Process.Start();
string lined = Process.StandardOutput.ReadToEnd();
string line = Process.StandardError.ReadToEnd();
if (String.IsNullOrEmpty(lined))
{
richTextBox2.AppendText(line + Environment.NewLine);
}
if (String.IsNullOrEmpty(line))
{
richTextBox2.AppendText(lined + Environment.NewLine);
}
Process.WaitForExit();
if (checkBox2.Checked == true)
{
Win32.SendMessage(PluginBase.GetCurrentScintilla(), SciMsg.SCI_SETTEXT, 0, richTextBox2.Text);
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.Write(ex.Message);
}