Delay 1000
Call Plugin.Web.Bind("wqm.exe")
//<>===================================================打开网页免费申请
Call Plugin.Web.Tips("打开申请界面")
Plugin.Web.ClearCookie 
Call Plugin.Web.Go("http://reg.email.163.com/unireg/call.do?cmd=register.entrance&from=email163®Page=163")
Call Plugin.Web.SetSize(1024,850)
//iehwnd=Plugin.Web.GetHwnd()
//Call Plugin.Window.Max(iehwnd) 
Delay 1000
//<>===================================================输入名字
Call Plugin.Web.LeftClick(200,250)
Delay 500
name = Lib.算法.随机字符串(8)
pwd = name & Lib.算法.随机数字串(4)
//保存注册信息
Text = Plugin.File.ReadFileEx("c:\163mail.txt")
fileLen=Plugin.File.GetFileLength("c:\163mail.txt")   
handle = Plugin.File.OpenFile("c:\163mail.txt")
Call Plugin.File.WriteFile(handle, Text & chr(13) & pwd)
Call Plugin.File.CloseFile(handle)  
//保存信息结束
Call Plugin.Web.HtmlInput(pwd, "id:nameIpt")
//<>===================================================输入密码
Call Plugin.Web.LeftClick(200,317)
Delay 500
Call Plugin.Web.Tips("输入密码,默认密码:a111111")
Call Plugin.Web.KeyPress(69)
For 4
    Call Plugin.Web.KeyPress(49)
Next
 Call Plugin.Web.KeyPress(55)
Delay 500
//<>===================================================确认密码
Call Plugin.Web.LeftClick(200,387)
Delay 500
Call Plugin.Web.KeyPress(69)
For 4
    Call Plugin.Web.KeyPress(49)
Next
 Call Plugin.Web.KeyPress(55) 
Delay 500
//<>==================================================输入验证码
Call Plugin.Web.LeftClick(220,470)
Call Plugin.Web.Tips("等待输入验证码,结束按回车键")
Delay 500
Rem 等待
key=WaitKey()
//<>===================================================按回车键即可提交申请
If key=13 Then
    Goto 离开
End If 
Goto 等待
Rem 离开
//<>===================================================确定并同意以下条款
Call Plugin.Web.Tips("注册提交")
Call Plugin.web.HtmlClick("id:mobileRegA")
Call Plugin.web.HtmlClick("id:mobileRegA_d")
Call Plugin.Web.LeftClick(230,590)
Delay 500
//<>===================================================判断是否注册成功,如果成功就结束就完成本次注册。如果不是继续验证码信息
url = Plugin.Web.GetURL
url_reg = "reg.email.163.com"
url_login = "cwebmail.mail.163.com" 
url_num = 0
url_num = Instr(1, url, url_reg)
//TracePrint url_num
If url_num>0 then
	Call Plugin.Web.LeftClick(405,405)
	Call Plugin.Web.Tips("等待再次输入验证码,结束按回车键")
	Delay 500
	Rem 等待2
	key = WaitKey()
	If key=13 Then
    	Goto 离开2
	End If 
	Goto 等待2
	Rem 离开2
	Call Plugin.Web.Tips("注册提交")
	Call Plugin.web.HtmlClick("id:mobileRegA")
	Call Plugin.web.HtmlClick("id:mobileRegA_d")
	Call Plugin.Web.LeftClick(420,470)
	Delay 500
End If
EndScript 
Sub OnScriptExit()
    Call Plugin.Web.Tips("脚本停止运行")
End Sub