巧用Windows Script Host编写自动申请QQ号码脚本

Windows Script Host是个很有意思的东西,利用它跟Windows系统内部的运作,可以把一些相对复杂的问题简单化,比如申请qq号码,完全可以转化成“建立IE进程-》发送模拟按键填写信息”这样一个过程。

 

什么是Windows Script Host?

Windows Script Host (WSH) is a Windows administration tool.

WSH creates an environment for hosting scripts. That is, when a script arrives at your computer, WSH plays the part of the host — it makes objects and services available for the script and provides a set of guidelines within which the script is executed. Among other things, Windows Script Host manages security and invokes the appropriate script engine.

WSH is language-independent for WSH-compliant scripting engines. It brings simple, powerful, and flexible scripting to the Windows platform, allowing you to run scripts from both the Windows desktop and the command prompt.

Windows Script Host is ideal for noninteractive scripting needs, such as logon scripting, administrative scripting, and machine automation.

MSDN:http://msdn.microsoft.com/en-us/library/9bbdkx3k(v=VS.85).aspx


下面就是一个小例子,将代码保存为a.vbs并执行,等到光标在输入验证码框时输入验证码,即可获得一个新的QQ号码。

   1: Set a=WScript.CreateObject("WScript.shell") 
   2: a.run "http://newreg.qq.com/" '打开QQ号码申请页面 
   3: WScript.Sleep 4000 '延时10秒,等待页面载入 
   4: a.SendKeys "username_123" '这里填写昵称 
   5: a.SendKeys "{TAB}" 
   6: WScript.Sleep 200 
   7: a.SendKeys "{DOWN}" 
   8: a.SendKeys "{TAB}" 
   9: WScript.Sleep 200 
  10: a.SendKeys "{DOWN}" 
  11: a.SendKeys "{TAB}" 
  12: WScript.Sleep 200 
  13: a.SendKeys "{DOWN}" 
  14: WScript.Sleep 200 
  15: a.SendKeys "{TAB}" 
  16: WScript.Sleep 200 
  17: a.SendKeys "{TAB}" 
  18: WScript.Sleep 200 
  19: a.SendKeys "password123" '这里是密码 
  20: a.SendKeys "{TAB}" 
  21: WScript.Sleep 200 
  22: a.SendKeys "password123" '再次输入密码 
  23: WScript.Sleep 200 
  24: a.SendKeys "{TAB}" 
  25: WScript.Sleep 200 
  26: a.SendKeys "{TAB}" 
  27: WScript.Sleep 200 
  28: a.SendKeys "{TAB}" 
  29: WScript.Sleep 200 
  30: a.SendKeys "{TAB}"
  31: WScript.Sleep 4000 '填写验证图片
  32: a.SendKeys "{ENTER}"
  33: WScript.Sleep 4000 '填写验证图片

转载于:https://www.cnblogs.com/lei1016cn/archive/2010/09/25/1834438.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值