在powershell中,有没有一种方法可以监听软件产生的消息提示,从而终止消息提示?
例如,如果我正在使用一个应用程序,然后它会提示用户单击"OK“。有没有办法可以用PowerShell找到那个“窗口标题”来终止提示符?
发布于 2018-09-06 00:20:25
您可以使用以下两个命令:
$TitleToKill = "CMD"
get-process | where-object {$_.MainWindowTitle -eq $TitleToKill} | stop-process发布于 2016-03-25 23:40:06
我决定选择AutoIt。
我注意到AutoIt有一个AutoIt窗口信息工具,你可以将鼠标悬停在消息提示符上。然后,窗口信息将为您提供窗口标题、文本和类ID (如果有)。
然后,您可以编写一个简单的autoit脚本,该脚本将等待消息提示并将其关闭。
我正在使用的示例脚本。
WinWait("[CLASS:#32770]", "Cannot sign in to Lync because this sign-in address was not found. Please verify the sign-in address and try again. If the problem continues, please contact your support team.", 0)
WinClose( "Lync")WinWait将等待包含该特定消息的提示,然后将其关闭。一旦它执行了操作并关闭了窗口。EXE将关闭并停止运行,当然,除非您将其编程为不关闭和循环。
https://stackoverflow.com/questions/36186737
复制相似问题