#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=E:\autoit3\Aut2Exe\Icons\windows.ico
#AutoIt3Wrapper_outfile=宽带连接创建程序.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=宽带连接创建程序
#AutoIt3Wrapper_Res_Description=宽带连接创建程序,一键搞定,方便家庭装机使用!
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
#AutoIt3Wrapper_Res_LegalCopyright=网管联盟( www.wglm.net)
#AutoIt3Wrapper_Res_Field=作者|It__Beau
#AutoIt3Wrapper_Res_Field=联系QQ|77099107
#AutoIt3Wrapper_Res_Field=技术网站|www.wglm.net
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
;#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("宽带连接自动化工具", 273, 78, 193, 115)
$ok1 = GUICtrlCreateButton("开始创建", 192, 8, 75, 65, 0)
$Input1 = GUICtrlCreateInput("", 64, 8, 121, 21)
$Input2 = GUICtrlCreateInput("", 64, 48, 121, 21)
$Label1 = GUICtrlCreateLabel("宽带账号", 10, 16, 50, 17)
$Label2 = GUICtrlCreateLabel("宽带密码", 10, 48,50, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ok1
If GUICtrlRead($Input1)="" Then
MsgBox(16,"提示","输入不能为空,程序即将退出!",2)
Exit
Else
EndIf
;创建连接
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
Opt("WinSearchChildren", 1)
Opt("WinTextMatchMode", 2)
Run("rundll32.exe netshell.dll,StartNCW")
WinWait("新建连接向导", "欢迎使用新建连接向导")
WinSetState("新建连接向导", "欢迎使用新建连接向导", @SW_HIDE)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "连接到我的工作场所")
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "手动设置我的连接")
ControlClick("[LAST]", "", 22129)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "用拨号调制解调器连接")
ControlClick("[LAST]", "", 22121)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "ISP 名称")
ControlSetText("[LAST]", "", 1680, "宽带连接")
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "任何用户从这台计算机")
Dim $id,$pwd
$id=GUICtrlRead($Input1)
$pwd=GUICtrlRead($Input2)
ControlSetText("[LAST]", "", 1614, $id)
ControlSetText("[LAST]", "", 1615,$pwd)
ControlSetText("[LAST]", "", 1616,$pwd)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "正在完成新建连接向导")
ControlClick("[LAST]", "", 12325)
Sleep(50)
If ControlCommand("网络配置", "", 65535, "IsVisible") Then
WinSetState("[LAST]", "", @SW_HIDE)
;WinSetState("网络配置", "连接已存在", @SW_HIDE)
ControlClick("[LAST]", "", 2)
ControlClick("新建连接向导", "正在完成新建连接向导", 2)
TrayTip("", "宽带连接已存在!", 15, 1)
Sleep(2000)
Exit
EndIf
TrayTip("", "宽带连接已成功创建!", 15, 1)
Sleep(2000)
Exit
EndSwitch
WEnd |