Dim WshShell, QQPath, QQselect
QQPath="C:/Program Files/Tencent/QQ/QQ.exe"
Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.Run chr(34)&"C:/Program Files/Tencent/QQ/QQ.exe"&chr(34)
WScript.Sleep 2000
WshShell.AppActivate "QQ用户登录"
WshShell.SendKeys "+{TAB}"
WshShell.SendKeys "qhao"
WScript.Sleep 200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "mima"
WScript.Sleep 200
WshShell.SendKeys "{ENTER}"
-----------------------------------------------qqlogin
Set a=CreateObject("WScript.shell")
login "admin","123456"
sub login(usernames,passwords)
a.run "iexplore.exe http://127.0.0.1:7979/jsptest"
WScript.Sleep 5000
a.AppActivate "login.jsp"
a.SendKeys "{TAB}"
a.SendKeys "{TAB}"
a.SendKeys usernames
a.SendKeys "{TAB}"
'WScript.Sleep 1000
a.SendKeys passwords
a.SendKeys "{ENTER}"
'WScript.Sleep 500
a.AppActivate "login.jsp" '激活当前窗口 很重要!
'wscript.sleep 100
'a.sendkeys"%{f4}" '自动关闭
end sub
----------------------------------------indexlogin