我有一个用C#编写的程序和由praat (语音学软件)计算的值。我已经有一个与praatcon.exe一起运行的praat脚本,它在Windows (cmd.exe)上打印结果。我可以在我的C#应用程序中使用这个结果吗?多么?
或者是否有更好的方法来获得结果,例如使用命令“send套接字”?这个怎么用?
编辑:--它使用以下代码工作得很好:
ProcessStartInfo si = new ProcessStartInfo();
si.FileName = "praatcon.exe"; //name of the handle program from sysinternals
//assumes that it is in the exe directory or in your path
//environment variable
//the following three lines are required to be able to read the output (StandardOutput)
//and hide the exe window.
si.RedirectStandardOutput = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
si.UseShellExecute = false;
si.Arguments = "-a example.praat filename.wav"; //you can specify whatever parameters praatcon.exe needs here; -a is mandatory!
//these 4 lines create a process object, start it, then read the output to
//a new string variable "s"
Process p = new Process();
p.StartInfo = si;
p.Start();
string s = p.StandardOutput.ReadToEnd();在-a中使用“praatcon.exe”参数是非常重要的。参见解释这里。
发布于 2010-11-22 16:03:33
下面是如何捕获另一个exe的控制台输出。
这都在System.Diagnostics命名空间中。
ProcessStartInfo si = new ProcessStartInfo();
si.FileName = "praat.exe"; //name of the program
//assumes that its in the exe directory or in your path
//environment variable
//the following three lines are required to be able to read the output (StandardOutput)
//and hide the exe window.
si.RedirectStandardOutput = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
si.UseShellExecute = false;
si.Arguments = "InputArgsHere"; //You can specify whatever parameters praat.exe needs here
//these 4 lines create a process object, start it, then read the output to
//a new string variable "s"
Process p = new Process();
p.StartInfo = si;
p.Start();
string s = p.StandardOutput.ReadToEnd();发布于 2010-11-22 16:03:09
我认为应该有一个服务,连接您与praat,以获得所需的数据。
https://stackoverflow.com/questions/4247376
复制相似问题