作为活动窗口打开

时间:2018-08-09 12:32:07

标签: vbscript

我正在尝试创建一个非常简单的vbscript,以打开浏览器到特定网页,然后刷新。我遇到的问题是试图使浏览器成为活动窗口,我搜索了各种站点并尝试了各种形式的appactivate,但均未成功。我通常不使用VBS,所以我可能会缺少一些明显的东西,请参阅下面的内容

set wshShell = WScript.CreateObject("wscript.shell")
wshShell.Run("http://www.example.com")
wshell.senkeys "{F5}"

我将非常感谢您的协助。

1 个答案:

答案 0 :(得分:0)

您可以使用“ AppActivate”,并且需要等待响应:

set wshShell = WScript.CreateObject("wscript.shell")
wshShell.Run("http://www.example.com")
Wscript.Sleep 1000
wshShell.AppActivate "Firefox" 'here put the name of the window
Wscript.Sleep 1000
wshell.senkeys "{F5}"
相关问题