2

使用 Powershell 和 WASP,我正在尝试自动删除和重新安装服务。

如果未安装该服务,我会看到“Windows Installer”对话框、“此操作仅对当前安装的产品有效”和“确定”按钮。

Powershell 和 WASP 可以检测到“Windows Installer”标题栏和“确定”按钮:

$intCountdownSeconds=5
do {
    start-sleep -s 1
    $intCountdownSeconds--
} until ((select-window -title $strWindowsInstallerTitlebar | select-control -title "ok*" -recurse) -or ($intCountdownSeconds -le 0))

是否可以使用 GetWindowText() 函数检测对话框的“此操作仅有效...”部分?这与我到目前为止所获得的一样接近:

select-window -title "windows installer" | select-control | get-member

TypeName: Huddled.Wasp.Control

Name             MemberType Definition
----             ---------- ----------
...
GetWindowText    Method     string GetWindowText()
...
4

0 回答 0