//登陆账号的函数
Function 登陆(用户名, 密码)
Dim lunPath
lunPath = Split(Form1.BrowseBox1.Path, "\")
i = 0
While lunPath(i) <> ""
i = i + 1
Wend
lunPath = Split(lunPath(i - 1), ".")
serverName = lunPath(0)
当前任务 = "登陆账号:" & 用户名
addLog (当前任务)
//判断是否找到窗口
temp=0
While temp > - 1
temp = temp + 1
FindPic 0,0,SCX,SCY,"Attachment:\pwd.bmp",0.9,intX,intY
If intX > 0 And intY > 0 Then
temp = - 1
End If
If temp > 15 Then
MessageBox "未找到窗口!"
ExitScript
End If
Delay 500
Wend
MoveTo intX + 100, intY + 10
LeftClick 1
SayString 用户名
KeyPress "Tab", 1
SayString 密码
KeyPress "Tab", 1
KeyPress "Enter", 1
Delay 500
temp = 0
While temp > - 1
FindPic 0,0,SCX,SCY,"Attachment:\login.bmp",1,intX,intY
If intX > 0 And intY > 0 Then
temp = - 1
End If
Delay 500
Wend
MoveTo intX + 60, intY + 40
LeftClick 1
当前任务 = "游戏载入中......"
addLog (当前任务)
Delay 7000
Fwnd = Plugin.Window.Find(0, serverName)
Hwnd = Plugin.Window.FindEx(Fwnd, 0, 0, 0)
Call Plugin.Window.Restore(Fwnd)
Delay 500
Call Plugin.Window.Size(Fwnd, 1004, 630)
//判断是否载入完毕
temp = 0
While temp > - 1
Delay 1000
pxc = Plugin.Bkgnd.GetPixelColor(Hwnd, 385, 587)
If pxc = "014A9E" Then
temp = - 1
End If
Wend
Delay 1000
//关闭阻挡的窗口
X = 0 : Y = 0
While X > - 1 and Y > - 1
XY = Plugin.Bkgnd.FindColor(Hwnd, 0, 0, 1366, 768, "A8F0FF")
dim MyArray
MyArray = Split(XY, "|")
X = Clng(MyArray(0)) : Y = Clng(MyArray(1))
If X > 0 and Y > 0 Then
Call Plugin.Bkgnd.LeftClick(Hwnd, X, Y)
Delay 50
Call Plugin.Bkgnd.KeyPress(Hwnd, 13)
Delay 700
End If
Wend
Call 退出场景
Call Plugin.Bkgnd.LeftClick(Hwnd, 911, 85)//隐藏人物
End Function