找回密码
 加入
搜索
楼主: jyj0732

[原创] 宽带连接创建程序[已添加图标文件][7.26更新]

  [复制链接]
发表于 2008-8-1 21:31:47 | 显示全部楼层
想要达到以下这种结果 还得请各位给看看 我用了楼主发的代码试了还是不行 请大家指教
              
发表于 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("[LAST]", "", 12324)
WinWait("新建连接向导", "连接到我的工作场所")
ControlClick("[LAST]", "", 22126)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "虚拟专用网络连接")
ControlClick("[LAST]", "", 22119)
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "公司名")
ControlSetText("[LAST]", "", 1680, "gongsi")
ControlClick("[LAST]", "", 12324)
If winwait("新建连接向导", "不拨初始连接") then
ControlClick("[LAST]", "", 1509)
ControlClick("[LAST]", "", 12324)
EndIf
WinWait("新建连接向导", "输入您正连接的")
ControlSetText("[LAST]", "", 1433, "60.60.60.8")
ControlClick("[LAST]", "", 12324)
WinWait("新建连接向导", "在我的桌面上添加一个")
ControlClick("[LAST]", "", 21005)
ControlClick("[LAST]", "", 12325)
Sleep(500)
AdlibDisable()
WinWait("连接", "用户名")
ControlSetText("[LAST]", "", 1104, "zhou")
ControlSetText("[LAST]", "", 1103, "zhou")
ControlClick("[LAST]", "", 1101)
ControlClick("[LAST]", "", 1623)
ControlClick("[LAST]", "", 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 编辑 ]
发表于 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("[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

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
发表于 2008-10-27 13:00:05 | 显示全部楼层

原创还是你的~!

原创还是你的~! 我是新手,盗用了你的不好意思哈`!
发表于 2008-10-27 13:01:23 | 显示全部楼层
能否在窗口加个进度条~! 更好看? 我加是加得上,但无法动起来`!请教楼主~!
发表于 2009-10-11 12:07:46 | 显示全部楼层
ddddddddddddddddddddddddddddddd
发表于 2016-5-9 17:00:02 | 显示全部楼层
有在WIN7下面的宽带连接的代码么?谢谢!
发表于 2017-2-12 15:04:35 | 显示全部楼层
支持原创!!!
发表于 2017-2-18 18:45:13 | 显示全部楼层
这不是我要的图标.....
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-21 20:13 , Processed in 0.071732 second(s), 15 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表