Run("CONTROL.EXE ncpa.CPL,@0") ;打开网络连接向导
WinWaitActive("网络连接", "") ;等待窗口出现
Dim $zb[4],$jiance ;声明变量
$zb = WinGetPos("网络连接", "") ;获取窗口坐标
$zb1 = ControlGetPos("网络连接", "", "DirectUIHWND1") ;获取控件坐标
$zb2 = $zb[0]+$zb1[0]
$zb3 = $zb[1]+$zb1[1]
MouseClick("", $zb2+90, $zb3+85) ;点击“创建一个新的连接"
$jiance = WinWaitActive("新建连接向导", "欢迎使用新建连接向导", 3)
;为防止”网络任务“菜单没有展开
If $jiance = 0 Then
MouseClick("", $zb2+90, $zb3+60) ;点击”网络菜单“
MouseClick("", $zb2+90, $zb3+85) ;点击“创建一个新的连接"
WinWaitActive("新建连接向导", "欢迎使用新建连接向导")
EndIf
ControlClick("新建连接向导", "", "Button2") ;点击”下一步“
WinWaitActive("新建连接向导", "连接到 Internet(&C)")
ControlClick("新建连接向导", "", "Button6") ;点击”下一步“
WinWaitActive("新建连接向导", "手动设置我的连接(&M)")
ControlClick("新建连接向导", "", "Button2") ;选择"手动设置我的连接“
ControlClick("新建连接向导", "", "Button9") ;点击”下一步“
WinWaitActive("新建连接向导", "用拨号调制解调器连接(&D)")
ControlClick("新建连接向导", "", "Button2") ;选择"用要求用户名和密码的宽带连接来连接“
ControlClick("新建连接向导", "", "Button12") ;点击”下一步“
WinWaitActive("新建连接向导", "在下面框中输入您的 ISP 的名称")
ControlSend ("新建连接向导", "", "Edit1", "宽带连接2") ;输入连接名称
ControlClick("新建连接向导", "", "Button12") ;点击”下一步“
WinWaitActive("新建连接向导", "用户名(&U):")
ControlClick("新建连接向导", "", "Button17") ;点击”下一步“
WinWaitActive("新建连接向导", "正在完成新建连接向导")
ControlClick("新建连接向导", "", "Button1") ;选择“桌面快捷方式”
ControlClick("新建连接向导", "", "Button21") ;点击”完成“
WinWaitActive("连接 宽带连接2", "")
WinClose("连接 宽带连接2", "") ;关闭窗口
WinClose("网络连接", "") ;关闭窗口