[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
谢谢啊,没想到引起如此深刻的讨论。代码还那么长。。

TOP

不过vbs还真看不懂。。。

TOP

看不懂,这有点复杂

TOP

回复 15# ygqiang
可不可以请教一下为什么要三次输入qq账号吗?

TOP

回复 19# sepwolves
  1. RunAsAdminstrator
  2. Function GetQQPath()
  3.   Const HKEY_LOCAL_MACHINE = &H80000002
  4.   Dim s, sREG, sDis, sPath, oReg, fso
  5.   sPath = ""
  6.   Set fso = CreateObject("Scripting.FileSystemObject")
  7.   Set Wss = CreateObject("Wscript.Shell")
  8.   Set oReg = GetObject("Winmgmts:\\.\Root\Default:StdRegProv")
  9.   sREG = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
  10.   oReg.EnumKey HKEY_LOCAL_MACHINE, sREG, s
  11.   If IsNull(s) = False Then
  12.     For i = 0 To Ubound(s)
  13.       oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "DisplayName", sDis
  14.       If Ucase(sDis) = "腾讯QQ" Then
  15.         oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "InstallLocation", sPath
  16.       End If
  17.     Next
  18.   End If
  19.   sREG = "SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall"
  20.   oReg.EnumKey HKEY_LOCAL_MACHINE, sREG, s
  21.   If IsNull(s) = False Then
  22.     For i = 0 To Ubound(s)
  23.       oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "DisplayName", sDis
  24.       If Ucase(sDis) = "腾讯QQ" Then
  25.         oReg.GetStringValue HKEY_LOCAL_MACHINE, sREG & "\" & s(i), "InstallLocation", sPath
  26.       End If
  27.     Next
  28.   End If
  29.   If sPath = "" Then
  30.     'MsgBox "未找到 腾讯QQ 的注册表路径", 4096
  31.     'CreateObject("Wscript.Shell").Popup "未找到 腾讯QQ 的注册表路径", 5
  32.     Wss.Popup "未找到 腾讯QQ 的注册表路径", 5
  33.     WScript.Quit(1)
  34.   Else
  35.     GetQQPath = fso.BuildPath(sPath, "Bin\QQ.exe")
  36.     If fso.FileExists(GetQQPath) = False Then
  37.       'MsgBox "未找到 " & GetQQPath, 4096
  38.       'CreateObject("Wscript.Shell").Popup "未找到 " & GetQQPath, 5
  39.       Wss.Popup "未找到 " & GetQQPath, 5
  40.       WScript.Quit(2)
  41.     End If
  42.   End If
  43. End Function
  44. Sub RunAsAdminstrator()
  45.     Dim shell, os, arg, ver
  46.     Set shell = CreateObject("Shell.Application")
  47.    
  48.     For Each os In GetObject("WinMgmts:").InstancesOf("Win32_OperatingSystem")
  49.         ver = Left(os.Version, 3)
  50.     Next
  51.     If ver <> "6.1" And ver <> "6.0" And ver <> "6.3" Then Exit Sub
  52.    
  53.     For Each arg In WScript.Arguments.Named
  54.         If LCase(arg) = "uac" Then Exit Sub
  55.     Next
  56.    
  57.     Shell.ShellExecute "wscript.exe", Chr(34) & _
  58.     WScript.ScriptFullName & Chr(34) & " /uac", "", "runas", 1
  59.     WScript.Quit
  60. End Sub
  61. '定义QQ程序路径、帐号、密码
  62. Dim Program1,a,b,c
  63. Program1 = GetQQPath()
  64. 'MsgBox Program1
  65. Set WshShell=createobject("wscript.shell")
  66. '运行QQ主程序
  67. Set oExec=WshShell.Exec(Program1)
  68. WScript.Sleep 5000
  69. '激活QQ窗口
  70. WshShell.SendKeys "{TAB}"
  71. WshShell.SendKeys "{TAB}"
  72. WshShell.SendKeys "{TAB}"
  73. WshShell.SendKeys "{TAB}"
  74. WshShell.SendKeys "{TAB}"
  75. WshShell.SendKeys "{TAB}"
  76. WshShell.SendKeys "{TAB}"
  77. WshShell.SendKeys "{TAB}"
  78. WshShell.SendKeys "{TAB}"
  79. WshShell.SendKeys "{TAB}"
  80. WshShell.SendKeys "{TAB}"
  81. WshShell.SendKeys "{TAB}"
  82. WScript.Sleep 3000
  83. '输入帐号
  84. a="qq号码"
  85. WshShell.SendKeys a
  86. WScript.Sleep 1000
  87. WshShell.SendKeys "{ENTER}"
  88. WScript.Sleep 2000
  89. '输入密码
  90. b="qq密码"
  91. WshShell.SendKeys b
  92. WScript.Sleep 2000
  93. WshShell.SendKeys "{ENTER}"
复制代码

TOP

返回列表