CrLf 发表于 2015-5-5 23:37 %
作者: ygqiang 时间: 2015-5-5 23:43
如果是正常安装的官方版本,可以试试这个:实测 QQ7.1 有效,不确定是否通用于 TM、QQ国际版或其他版本 QQ
CrLf 发表于 2015-5-5 23:37
多谢。。win7 64系统下,测试了下。。好用。。。
不过你这个是bat代码。。。不是vbs的。。。
作者: CrLf 时间: 2015-5-6 00:12
回复 4# ygqiang
vbs 原理一样:- Set fso = WScript.CreateObject("Scripting.Filesystemobject")
- Set WS = CreateObject("Wscript.Shell")
-
- Tencent = WS.RegRead("HKEY_CLASSES_ROOT\Tencent\shell\open\command\")
- QQ = Replace(Tencent,"""","")
- QQ = fso.GetFolder(QQ&"\..")&"\QQ.exe"
-
- MsgBox QQ
复制代码
作者: ygqiang 时间: 2015-5-6 06:25
回复 5# CrLf
多谢。。。。。下面这个vbs代码,是否有进一步简化的可能。。。。- Dim Program1,a,b
- Set fso = WScript.CreateObject("Scripting.Filesystemobject")
- Set WshShell = CreateObject("Wscript.Shell")
- Tencent = WshShell.RegRead("HKEY_CLASSES_ROOT\Tencent\shell\open\command\")
- Program1 = Replace(Tencent,"""","")
- Program1 = fso.GetFolder(Program1&"\..")&"\QQ.exe"
- 'MsgBox Program1
-
-
- '运行QQ主程序
- Set oExec=WshShell.Exec(Program1)
- WScript.Sleep 3000
- '激活QQ窗口
- WshShell.AppActivate "qq"
- wshShell.SendKeys "+{TAB}"
- '输入帐号
- a="qq号码"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- '输入帐号
- a="qq号码"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- WScript.Sleep 1000
- '输入密码
- b="qq密码"
- WshShell.SendKeys b
- WScript.Sleep 1000
- WshShell.SendKeys "{ENTER}"
复制代码
作者: gawk 时间: 2015-5-6 08:46
回复 6# ygqiang
“输入帐号”写两遍有啥原因吗
作者: ygqiang 时间: 2015-5-6 10:25
回复 7# gawk
装最新版本qq, 如果只输入1次。。测试过。不行。。。
作者: ygqiang 时间: 2015-5-6 12:51
回复 5# CrLf
初步解决了。。。
情况1(如果已经确定装了qq软件)————————————————————————————————————- '定义QQ程序路径、帐名、密码
- Dim Program1,a,b
-
- Set fso = WScript.CreateObject("Scripting.Filesystemobject")
- Set WshShell = CreateObject("Wscript.Shell")
- Tencent = WshShell.RegRead("HKEY_CLASSES_ROOT\Tencent\shell\open\command\")
- Program1 = Replace(Tencent,"""","")
- Program1 = fso.GetFolder(Program1&"\..")&"\QQ.exe"
- 'MsgBox Program1
-
- '运行QQ主程序
- Set oExec=WshShell.Exec(Program1)
- WScript.Sleep 3000
- '激活QQ窗口
- WshShell.AppActivate "qq"
- WScript.Sleep 1000
- 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}"
复制代码
作者: ygqiang 时间: 2015-5-6 12:51
回复 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秒后自动关闭对话框。。
作者: pcl_test 时间: 2015-5-6 13:04
回复 10# ygqiang
MsgBox "未找到 腾讯QQ 的注册表路径", 4096改为
CreateObject("Wscript.Shell").Popup "未找到 腾讯QQ 的注册表路径", 5
作者: ygqiang 时间: 2015-5-6 13:13
回复 ygqiang
“输入帐号”写两遍有啥原因吗
gawk 发表于 2015-5-6 08:46
为啥要输入2次qq号码??
应该是按键后用于获取焦点之类的
估计是第一次用于获取焦点..第一次可以只直接随意输入一个按键..
然后再输入账号。。
作者: zz100001 时间: 2015-5-6 16:13
你这是在弄QQ自动登陆吗?
找马化腾协商一下,弄个命令行接口不是最简单。。。。
下面是一个启动指定QQ号的vbs代码,你可以试试,密码还得自己输
(账号可以是邮箱的)- ' 创建QQ自带的对象
- Set c = WScript.CreateObject("QQCPHelper.CPAdder")
- ' 启动QQ并指定一个号码
- c.StartupIM "273088140"
复制代码
作者: CrLf 时间: 2015-5-6 16:45
回复 13# zz100001
补充一下,QQ 和 TM 都支持命令行参数,例如:- "C:\Program Files\Tencent\TM\Bin\TM.exe" /uin:10000
复制代码
作者: czjt1234 时间: 2015-5-6 17:15
回复 13# zz100001
赞一个
作者: ygqiang 时间: 2015-5-11 11:39
最终修改后的解决方案:- RunAsAdminstrator
- Function GetQQPath()
- Const HKEY_LOCAL_MACHINE = &H80000002
- Dim s, sREG, sDis, sPath, oReg, fso
- sPath = ""
- Set fso = CreateObject("Scripting.FileSystemObject")
- Set Wss = CreateObject("Wscript.Shell")
- 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
- 'CreateObject("Wscript.Shell").Popup "未找到 腾讯QQ 的注册表路径", 5
- Wss.Popup "未找到 腾讯QQ 的注册表路径", 5
- WScript.Quit(1)
- Else
- GetQQPath = fso.BuildPath(sPath, "Bin\QQ.exe")
- If fso.FileExists(GetQQPath) = False Then
- 'MsgBox "未找到 " & GetQQPath, 4096
- 'CreateObject("Wscript.Shell").Popup "未找到 " & GetQQPath, 5
- Wss.Popup "未找到 " & GetQQPath, 5
- WScript.Quit(2)
- End If
- End If
- End Function
-
- Sub RunAsAdminstrator()
- Dim shell, os, arg, ver
- Set shell = CreateObject("Shell.Application")
-
- For Each os In GetObject("WinMgmts:").InstancesOf("Win32_OperatingSystem")
- ver = Left(os.Version, 3)
- Next
- If ver <> "6.1" And ver <> "6.0" And ver <> "6.3" Then Exit Sub
-
- For Each arg In WScript.Arguments.Named
- If LCase(arg) = "uac" Then Exit Sub
- Next
-
- Shell.ShellExecute "wscript.exe", Chr(34) & _
- WScript.ScriptFullName & Chr(34) & " /uac", "", "runas", 1
- WScript.Quit
- End Sub
-
-
- '定义QQ程序路径、帐号、密码
- Dim Program1,a,b,c
-
- 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="qq帐号"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- '输入帐号
- a="qq帐号"
- WshShell.SendKeys a
- WScript.Sleep 1000
- WshShell.SendKeys "{TAB}"
- WScript.Sleep 2000
- '输入密码
- b="qq密码前半部分"
- WshShell.SendKeys b
- WScript.Sleep 2000
-
- '输入密码
- c="qq密码后半部分"
- WshShell.SendKeys c
- WScript.Sleep 1000
-
- WshShell.SendKeys "{ENTER}"
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |