问题
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?
回答1:
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
来源:https://stackoverflow.com/questions/16502385/vbscript-getting-application-window-text