vendredi 16 novembre 2018

Focus lost for IE when using vb script

I am trying to launch IE and passing calc.exe path as a URL and downloading it. But after passing the URL, the focus of WshShell is moved to another point. Below is my script.

strWebSite = "file://C:/Windows/System32/calc.exe"
Set ie = GetObject ("", "internetexplorer.application")
ie.Navigate2 strWebSite
WScript.Sleep 500
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.AppActivate("Internet Explorer")
WScript.Sleep 3000
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "{TAB}"
WScript.Sleep 3000
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"

Aucun commentaire:

Enregistrer un commentaire