CODE: [Copy to clipboard]
'简单的打开浏览器浏览某个公共页面
'set huobilie = Wscript.CreateObject("Wscript.Shell")
'huobilie.run "iexplore http://www.baidu.com"
Set ie = Wscript.CreateObject("InternetExplorer.Application")
ie.Navigate "about:blank"
ie.ToolBar = 0
ie.StatusBar = 0
ie.Width=400
ie.Height = 100
ie.Left = 300
ie.Top = 300
SynchronizeIE()
ie.Visible = 1
ie.Document.Body.InnerHTML = "自动输入"
WScript.Sleep 2000
ie.navigate "www.baidu.com"
SynchronizeIE()
Set wshshell=CreateObject("wscript.shell")
wscript.sleep 500
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wshshell.Sendkeys"{TAB}"
wscript.Sleep 500
wshshell.Sendkeys"a"
wshshell.Sendkeys"d"
wshshell.Sendkeys"m"
wshshell.Sendkeys"i"
wshshell.Sendkeys"n"
wshshell.Sendkeys"{ENTER}"
SynchronizeIE()
ie.Visible=1
'WShell.SendKeys "~" ' 回车
'wscript.Sleep 5000
'Wshell.SendKeys "^W" ' 关闭IE窗口
'//等待IE操作结束。
Function SynchronizeIE()
While ie.Busy
WScript.Sleep(100)
Wend
'Do
' Wscript.Sleep 200
'Loop Until ie.ReadyState=4
End Function
下面是bat随机运行VBS的脚本: