回复 5# CrLf
情况2(如果不确定是否装了qq软件)————————————————————————————————————- Function GetQQPath()
- Const HKEY_LOCAL_MACHINE = &H80000002
- Dim s, sREG, sDis, sPath, oReg, fso
- sPath = ""
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set oReg = GetObject("Winmgmts:\\.\Root\Default:StdRegProv")
- sREG = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
- oReg.EnumKey HKEY_LOCAL_MACHINE, sREG, s
- If IsNull(s) = False Then
- For i = 0 To Ubound(s)
- oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "DisplayName", sDis
- If Ucase(sDis) = "腾讯QQ" Then
- oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "InstallLocation", sPath
- End If
- Next
- End If
- sREG = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
- oReg.EnumKey HKEY_LOCAL_MACHINE, sREG, s
- If IsNull(s) = False Then
- For i = 0 To Ubound(s)
- oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "DisplayName", sDis
- If Ucase(sDis) = "腾讯QQ" Then
- oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "InstallLocation", sPath
- End If
- Next
- End If
- If sPath = "" Then
- MsgBox "未找到 腾讯QQ 的注册表路径", 4096
- WScript.Quit(1)
- Else
- GetQQPath = fso.BuildPath(sPath, "Bin\QQ.exe")
- If fso.FileExists(GetQQPath) = False Then
- MsgBox "未找到 " & GetQQPath, 4096
- WScript.Quit(2)
- End If
- End If
- End Function
-
-
-
- '定义QQ程序路径、帐名、密码
- Dim Program1,a,b
-
- Program1 = GetQQPath()
- 'MsgBox Program1
- Set WshShell=createobject("wscript.shell")
-
- '运行QQ主程序
- Set oExec=WshShell.Exec(Program1)
- WScript.Sleep 3000
- '激活QQ窗口
- WshShell.AppActivate "qq"
- wshShell.SendKeys "+{TAB}"
- WScript.Sleep 1000
- '输入帐号
- a="273088140"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- '输入帐号
- a="273088140"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- WScript.Sleep 2000
- '输入密码
- b="ygq$2008"
- WshShell.SendKeys b
- WScript.Sleep 1000
- WshShell.SendKeys "{ENTER}"
复制代码 如果没有装qq。会弹出这个对话框,
能否修改下vbs代码。设置:倒计时5秒后自动关闭对话框。。 |