3
votes

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
if you put SendKeys "{TAB}", does it take you to the text fields inside? i once have scripted a key sequence to do a database backup. A screenshot of that window would be helpful. - PatricK
We need a way to know what is the exact text in the window. For example when iterating through the windows the title could be similar but the text is what could help you identify the window that you are looking for. Thank You - lrl
It is not an installer, it is an automated testing with handling popup windows in a very strict and changing environment (nothing could be installed). - lrl

1 Answers

1
votes

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