2009年6月16日星期二

qq2009脚本自动登陆 v2

更新:1.添加测试网络连接部分
2.使用select case 语句

Dim WshShell, QQPath, QQselect
QQPath="""C:\Program Files\Tencent\QQ\Bin\QQ.exe"""
Set WshShell=WScript.CreateObject("WScript.Shell")

If WeekDay(date)=7 Then WScript.Quit
IF WeekDay(date)=1 Then WScript.Quit

''''测试网络连接
Do While 1
Url="ping www.google.com -n 1"
Return=WshShell.Run( "cmd /c"&Url,0,true)
If Return=0 then Exit Do '测试成功,不成功则继续等待
Wscript.Sleep 100
Loop

Set oQQ = WshShell.Exec(QQPath)

Do While 1
If WshShell.AppActivate(oQQ.ProcessID)=True Then '''激活qq窗口
'''移动光标到帐号密码输入框
Wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 100
wshshell.sendkeys"{TAB}"
WScript.Sleep 200

Select Case WeekDay(date)
case 2
WshShell.SendKeys"qq1"
WScript.Sleep 500
wshshell.sendkeys"{TAB}"
WScript.Sleep 200
wshshell.sendkeys"password1"
WScript.Sleep 500

case 3
WshShell.SendKeys"qq2"
WScript.Sleep 500
wshshell.sendkeys"{TAB}"
WScript.Sleep 200
Wshshell.sendkeys"password2"
WScript.Sleep 500

case 4
WshShell.SendKeys"qq3"
WScript.Sleep 500
wshshell.sendkeys"{TAB}"
wshshell.sendkeys"password3"
WScript.Sleep 500

case 5
WshShell.SendKeys"qq4"
WScript.Sleep 500
wshshell.sendkeys"{TAB}"
WScript.Sleep 200
wshshell.sendkeys"password4"
WScript.Sleep 500

case 6
WshShell.SendKeys"qq5"
WScript.Sleep 500
wshshell.sendkeys"{TAB}"
WScript.Sleep 200
wshshell.sendkeys"password5"
WScript.Sleep 500

End Select
'''输入帐号密码完毕
WshShell.SendKeys"{ENTER}"

Exit Do
END IF
Wscript.Sleep 100
Loop

没有评论:

发表评论