[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
看了一下代码,感觉75行
75.WshShell.AppActivate "qq"
有问题,可能并不能激活qq 对话框,因此下了代码,试了一下,好像真的不能哦。测试环境:WIN10和最新版QQ,如果我没记错,好像应该 用进程ID才行样。(不知是不是我没用对)。

TOP

比如我用start "" "d:\...\qq.exe"调用qq之后,出现登陆窗口,我要用什么代码才能让它自己登陆,然后最小化 ...
sepwolves 发表于 2015-11-17 08:37



    vbs代码。。。
  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.AppActivate "qq"
  71. wshShell.SendKeys "+{TAB}"
  72. WScript.Sleep 2000
  73. '输入帐号
  74. a="24545640"
  75. WshShell.SendKeys a
  76. WScript.Sleep 1000
  77. WshShell.SendKeys "{TAB}"
  78. '输入帐号
  79. a="24545640"
  80. WshShell.SendKeys a
  81. WScript.Sleep 1000
  82. WshShell.SendKeys "{TAB}"
  83. WScript.Sleep 2000
  84. '输入密码
  85. b="245756"
  86. WshShell.SendKeys b
  87. WScript.Sleep 2000
  88. WshShell.SendKeys "{ENTER}"
复制代码

TOP

回复 3# shuzai


    还有sendkey功能噢

TOP

qq登录窗不知道能不能用sendkey,你试试呗
echo hello

TOP

能 网了怎么做了就是

TOP

返回列表