[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
最终修改后的解决方案:
  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 3000
  69. '激活QQ窗口
  70. WshShell.AppActivate "qq"
  71. wshShell.SendKeys "+{TAB}"
  72. WScript.Sleep 1000
  73. '输入帐号
  74. a="qq帐号"
  75. WshShell.SendKeys a
  76. WScript.Sleep 1000
  77. WshShell.SendKeys "{TAB}"
  78. '输入帐号
  79. a="qq帐号"
  80. WshShell.SendKeys a
  81. WScript.Sleep 1000
  82. WshShell.SendKeys "{TAB}"
  83. WScript.Sleep 2000
  84. '输入密码
  85. b="qq密码前半部分"
  86. WshShell.SendKeys b
  87. WScript.Sleep 2000
  88. '输入密码
  89. c="qq密码后半部分"
  90. WshShell.SendKeys c
  91. WScript.Sleep 1000
  92. WshShell.SendKeys "{ENTER}"
复制代码

TOP

返回列表