vbscript:获取应用程序窗口文本 [英] vbscript : getting application window text

查看:44
本文介绍了vbscript:获取应用程序窗口文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 vbs 自动安装应用程序.我有一个代码可以启动 setup exe 文件并继续发送击键.但是现在我需要获取安装程序窗口的文本.我可以获得安装程序窗口的标题(使用 objShell.AppActivate )但没有找到获取该窗口文本的方法.有什么办法可以在 vbs 中捕获它吗?

I am automating the application installation using vbs. I have a code which launches the setup exe file and proceed further with sending the keystroks. But now I need to get the text of the installer window. I can get the title of installer window(using objShell.AppActivate ) but didn't found the way to get the text of that window. Is there any way to capture this in vbs?

推荐答案

另一种可能是枚举进程命令行而不是窗口:

An alternative could be to enumerate process command lines instead of windows:

Dim WshShell
Set WshShell = CreateObject("Wscript.Shell")

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process")

For Each objProcess in colProcesses
  If InStr(objProcess.CommandLine,"notepad")>0 Then
    WshShell.AppActivate objProcess.ProcessId  
 End If
Next

这篇关于vbscript:获取应用程序窗口文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆