浪子丹 发表于 2008-8-1 21:31:47

想要达到以下这种结果 还得请各位给看看 我用了楼主发的代码试了还是不行 请大家指教
http://sz.photo.store.qq.com/rurl2=323ec5692dbce525a03a174c72e624a8f0bf43be4869c4f7cf88eeb0af8d61faea80b72e0c0b3975c120626abb4ed3e661e323ae211414196fb3a23ce0b0d5036302af97d060df376ddd6144507a6da1d8365fcd             http://sz.photo.store.qq.com/rurl2=f3f9e226efc6c1a646baf1a61a534cc4caef1ec1adbe1bc0ceb773af612b16c8399542c099fdcd9ec6b5c7ebfa378d06747a93f22b61fb78e448357bb0843e74a5db7dad632de41221b803a0c6cd0ca0d0881ff7

浪子丹 发表于 2008-8-1 21:33:07

代码如下
#RequireAdmin
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=LAN.ico
#AutoIt3Wrapper_outfile=vpn连接创建程序.exe
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseAnsi=y
#AutoIt3Wrapper_Res_Comment=宽带连接创建程序
#AutoIt3Wrapper_Res_Description=宽带连接创建程序
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
#AutoIt3Wrapper_Res_LegalCopyright=GCH
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
;#NoTrayIcon
Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("MouseCoordMode", 0)
Opt("WinSearchChildren", 1)
Opt("WinTextMatchMode", 2)
AdlibEnable("end")
Func end()
If WinExists("网络配置", "") Then
ProcessClose("rundll32.exe")
TrayTip("", "VPN连接已存在!", 15, 1)
Sleep(1000)
Exit
EndIf
EndFunc
Run("rundll32.exe netshell.dll,StartNCW")
WinWait("新建连接向导", "欢迎使用新建连接向导")
WinSetState("新建连接向导", "欢迎使用新建连接向导", @SW_SHOW)
ControlClick("", "", 12324)
WinWait("新建连接向导", "连接到我的工作场所")
ControlClick("", "", 22126)
ControlClick("", "", 12324)
WinWait("新建连接向导", "虚拟专用网络连接")
ControlClick("", "", 22119)
ControlClick("", "", 12324)
WinWait("新建连接向导", "公司名")
ControlSetText("", "", 1680, "gongsi")
ControlClick("", "", 12324)
If winwait("新建连接向导", "不拨初始连接") then
ControlClick("", "", 1509)
ControlClick("", "", 12324)
EndIf
WinWait("新建连接向导", "输入您正连接的")
ControlSetText("", "", 1433, "60.60.60.8")
ControlClick("", "", 12324)
WinWait("新建连接向导", "在我的桌面上添加一个")
ControlClick("", "", 21005)
ControlClick("", "", 12325)
Sleep(500)
AdlibDisable()
WinWait("连接", "用户名")
ControlSetText("", "", 1104, "zhou")
ControlSetText("", "", 1103, "zhou")
ControlClick("", "", 1101)
ControlClick("", "", 1623)
ControlClick("", "", 1590)
ProcessClose("rundll32.exe")
TrayTip("", "VPN连接已成功创建!", 15, 1)
Sleep(2000)
FileMove(@AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk", @AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.ini", 9)
IniWrite(@AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.ini", "chinaunicom", "AuthRestrictions", "856")
Sleep(50)
FileMove(@AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.ini", @AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk", 9)
RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached',"{2559A1F4-21D7-11D4-BDAF-00C04F60B9F0} {000214E6-0000-0000-C000-000000000046} 0x401","REG_BINARY",'0000000031003000B0C5021CD0F3C801')
RegWrite ('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Shell Extensions\Cached',"{2559A1F5-21D7-11D4-BDAF-00C04F60B9F0} {000214E6-0000-0000-C000-000000000046} 0x401","REG_BINARY",'00000000310030009C26241CD0F3C801')
Sleep(50)
Exit

浪子丹 发表于 2008-8-1 21:35:26

不过还是谢谢楼主的代码 只能怪俺太“聪明”了 呵呵假如论坛要出书的话 楼主这段代码得入选案例 因为实用性及示范性很好

[ 本帖最后由 浪子丹 于 2008-8-1 21:38 编辑 ]

rl1320 发表于 2008-10-27 12:58:28

我把你那个小改了一下,觉得更方便些`!

#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("", "", 12324)
WinWait("新建连接向导", "连接到我的工作场所")
ControlClick("", "", 12324)
WinWait("新建连接向导", "手动设置我的连接")
ControlClick("", "", 22129)
ControlClick("", "", 12324)
WinWait("新建连接向导", "用拨号调制解调器连接")
ControlClick("", "", 22121)
ControlClick("", "", 12324)
WinWait("新建连接向导", "ISP 名称")
ControlSetText("", "", 1680, "宽带连接")
ControlClick("", "", 12324)
WinWait("新建连接向导", "任何用户从这台计算机")
Dim $id,$pwd
$id=GUICtrlRead($Input1)
$pwd=GUICtrlRead($Input2)
ControlSetText("", "", 1614, $id)
ControlSetText("", "", 1615,$pwd)
ControlSetText("", "", 1616,$pwd)
ControlClick("", "", 12324)
WinWait("新建连接向导", "正在完成新建连接向导")
ControlClick("", "", 12325)
Sleep(50)
If ControlCommand("网络配置", "", 65535, "IsVisible") Then
        WinSetState("", "", @SW_HIDE)
        ;WinSetState("网络配置", "连接已存在", @SW_HIDE)
        ControlClick("", "", 2)
        ControlClick("新建连接向导", "正在完成新建连接向导", 2)
        TrayTip("", "宽带连接已存在!", 15, 1)
        Sleep(2000)
        Exit
EndIf
TrayTip("", "宽带连接已成功创建!", 15, 1)
Sleep(2000)
Exit
        EndSwitch
WEnd

rl1320 发表于 2008-10-27 13:00:05

原创还是你的~!

原创还是你的~! 我是新手,盗用了你的不好意思哈`!

rl1320 发表于 2008-10-27 13:01:23

能否在窗口加个进度条~! 更好看? 我加是加得上,但无法动起来`!请教楼主~!

zhenglei 发表于 2009-10-11 12:07:46

ddddddddddddddddddddddddddddddd

cm84n7281 发表于 2016-5-9 17:00:02

有在WIN7下面的宽带连接的代码么?谢谢!

804260247 发表于 2017-2-12 15:04:35

支持原创!!!

悟雨 发表于 2017-2-18 18:45:13

这不是我要的图标.....
页: 1 2 [3]
查看完整版本: 宽带连接创建程序[已添加图标文件][7.26更新]