How can i give focus to a window? The thing is I am trying to do an unattended install of Ad-Aware and I'm running a VBscript to enter the installation password automatically.
Here the code
Set WshShell = WScript.CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
On Error Resume Next
WshShell.run "%SystemRoot%\System32\cmd.exe"
WScript.Sleep 2000
WshShell.SendKeys "H:\Adaware.exe /S"
WshShell.SendKeys "~"
WScript.Sleep 8000
WshShell.SendKeys "123456"
WScript.Sleep 2000
WshShell.SendKeys "~"
WScript.Sleep 2000
WshShell.SendKeys "exit"
WshShell.SendKeys "~"
Wscript.Quit
As you can see I'm running the cmd prompt to run the adaware silent mode installation then I need to give focus to the password windows that pops up while installing and then I would like to give focus again to cmd prompt so it closes.
Question
dlorenzo
How can i give focus to a window? The thing is I am trying to do an unattended install of Ad-Aware and I'm running a VBscript to enter the installation password automatically.
Here the code
As you can see I'm running the cmd prompt to run the adaware silent mode installation then I need to give focus to the password windows that pops up while installing and then I would like to give focus again to cmd prompt so it closes.
Any help is apreciated
note I erased my code just entered 123456
Link to comment
https://www.neowin.net/forum/topic/125635-vbscript-how-to-give-focus-to-a-window/Share on other sites
3 answers to this question
Recommended Posts