C#autoit WinWaitActive没有返回正确的值

时间:2016-02-21 07:50:53

标签: c# autoit

我试图从我在使用AutoIt v3控制的GUI中运行进程后出现的Messagebox中获取信息。消息框将显示成功消息或失败消息,我想记录这些结果,但它会继续进行“安装失败”。而不是成功'并且当我看到消息显示成功时,在日志中将其记录为失败。任何帮助表示赞赏。这是我的代码以及我评论过的想法:

internal void Install(string filepath)
{
   au3.Send("!i"); //Send ALT+I
   au3.WinWaitActive("Select Content Package", "", 20000); //Wait for window
   au3.WinActivate("Select Content Package"); //If something else came up focus back on it prior to next line
   au3.MouseClick("primary", 337,11); //Click on field as AutoIt cannot access it.
   au3.Send(filepath);
   au3.Send("{Enter}");
   if(au3.WinWaitActive("Program", "successfully installed.", 90) == 1)
   { //WinWaitActive should return 1 if it is successful. The messagebox contains the text "successfully installed."
      au3.Send("{Enter}");
      writeLog(filepath + " Successfully installed.")
   }
   else
   { //WinWaitActive should return 0 if timeout, thus triggering this code
      au3.Send("{Enter}");
      writeLog(filepath + " Failed Install.")
   }
}

0 个答案:

没有答案