0
我无法让QProcess从VBScript中读取任何输出。这个脚本自己执行,当从QProcess调用时,输出到QCreator的应用输出,所以我知道我的VBS正在执行。要解决我剪了我的VBS到:通过QProcess执行VBS Never Emits readyStandardOutPut
WScript.StdOut.WriteLine("Hi")
Qt的身边,我已经试过:
- 连接QProcess中的成品,readyReadStandardOutput, readyReadStandardError信号
- 我也试图setProcessChannelMode到QProcess :: MergedChannels
在MainWindow构造函数中:
个connect(Process,SIGNAL(readyReadStandardOutput()),this,SLOT(processDone()));
插槽:
void MainWindow::processDone()
{
qDebug()<<"Out";
/*QString str;
str.append(Process->readAllStandardOutput());
qDebug()<<str;*/
}
void MainWindow::runProcess()
{
QString script = "cscript";
QStringList args;
args<<QString(QDir::currentPath()+ "/myVBs.vbs")<<"//NoLogo";
Process->execute(script,args);
}
宾果。谢谢弗兰克! – RegularlyScheduledProgramming 2012-03-02 14:33:38