tryhi 发表于 2012-5-10 20:44:08

如何创建一个跟系统一样的宽带连接快捷方式

本帖最后由 afan 于 2012-5-12 19:30 编辑

FileCreateShortcut (@SystemDir & "\rasphone.exe", @DesktopCommonDir&"\宽带连接",@SystemDir, "-d 宽带连接" )


这样可以创建一个宽带连接,但这样的快捷方式是指向rasphone的,而不是指向网上邻居里面宽带连接,这样的话就不能实现这个快捷方式连上的时候是彩色,连不上的时候是灰色,我想问一下怎么才能创建一个跟系统创建的那个一样的快捷方式。

注:XP系统




--------------------------------------
续:大师的代码测试很成功,不过大师的代码会重新创建一个宽带连接,但我的目的达到了。

zldfsz 发表于 2012-5-10 20:44:09

本帖最后由 zldfsz 于 2012-5-11 21:06 编辑

回复 19# jsgh1983

试试这个吧
Switch @OSVersion
        Case "WIN_7"
                $rasphone = @AppDataDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk" ;当前用户 Application Data 目录所在路径
        Case "WIN_XP"
                $rasphone = @AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk"
        Case Else
                MsgBox(4096, "提示", "不支持该系统", 10)
                Exit
EndSwitch
FileOpen($rasphone, 10)
FileWrite($rasphone, rasphone_pbk())
FileWrite(@DesktopCommonDir & "\宽带连接.lnk", PPPoE())

Func PPPoE()
        If @OSVersion = "WIN_7" Then
                Local $FileBin = ""
                $FileBin &= "4C0000000114020000000000C0000000000000468100080000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000940114001F802020EC21EA3A6910A2DD08002B30309D1E00"
                $FileBin &= "718000000000000000000000C7AC07700232D111AAD200805FC1270E6001FF4E03000000FF5E0000D76A12BA6621D111B1D000805FC1270E254CF93345660941A9ED39AA79D671FE4E000000060000000000000034000000B4000000000000000A000000"
                $FileBin &= "0A0000002A00000000000000E800000002000000000000000000000000000000EA00000002000000BD5B265EDE8FA5630000570041004E0020004D0069006E00690070006F0072007400200028005000500050004F00450029000000140043003A005C00"
                $FileBin &= "550073006500720073005C007A00680061006E0067005C0041007000700044006100740061005C0052006F0061006D0069006E0067005C004D006900630072006F0073006F00660074005C004E006500740077006F0072006B005C0043006F006E006E00"
                $FileBin &= "65006300740069006F006E0073005C00500062006B005C00720061007300700068006F006E0065002E00700062006B000000254CF93345660941A9ED39AA79D671FE0000000005000000000000000000000000000000"
        Else
                Local $FileBin = ""
                $FileBin &= "4C0000000114020000000000C0000000000000468100000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000B00114001F50E04FD020EA3A6910A2D808002B30309D1400"
                $FileBin &= "2E002020EC21EA3A6910A2DD08002B30309D14007000C7AC07700232D111AAD200805FC1270E7201FF4E02000000FF5E0F3800000000D76A12BA6621D111B1D000805FC1270E254CF93345660941A9ED39AA79D671FE5F04000006000000000000002C00"
                $FileBin &= "0000E0000000000000000A0000000A00000022000000000000000C01000002000000BD5B265EDE8FA5630000570041004E002000AE5F8B57EF7AE353200028005000500050004F00450029000000140043003A005C0044006F00630075006D0065006E00"
                $FileBin &= "74007300200061006E0064002000530065007400740069006E00670073005C0041006C006C002000550073006500720073005C004100700070006C00690063006100740069006F006E00200044006100740061005C004D006900630072006F0073006F00"
                $FileBin &= "660074005C004E006500740077006F0072006B005C0043006F006E006E0065006300740069006F006E0073005C00500062006B005C00720061007300700068006F006E0065002E00700062006B000000254CF93345660941A9ED39AA79D671FE01000000"
                $FileBin &= "050000000000180F000000000000"
        EndIf
        Return Binary("0x" & $FileBin)
EndFunc   ;==>PPPoE
Func rasphone_pbk()
        Local $FileBin = ""
        $FileBin &= "5BE5AEBDE5B8A6E8BF9EE68EA55D0D0A456E636F64696E673D310D0A547970653D350D0A4175746F4C6F676F6E3D300D0A55736552617343726564656E7469616C733D310D0A4469616C506172616D735549443D393532323635360D0A477569643D3235"
        $FileBin &= "3443463933333435363630393431413945443339414137394436373146450D0A4261736550726F746F636F6C3D310D0A56706E53747261746567793D300D0A4578636C7564656450726F746F636F6C733D300D0A4C6370457874656E73696F6E733D310D"
        $FileBin &= "0A44617461456E6372797074696F6E3D380D0A5377436F6D7072657373696F6E3D310D0A4E65676F74696174654D756C74696C696E6B416C776179733D300D0A536B69704E77635761726E696E673D300D0A536B6970446F776E4C6576656C4469616C6F"
        $FileBin &= "673D300D0A536B6970446F75626C654469616C4469616C6F673D300D0A4469616C4D6F64653D310D0A4469616C50657263656E743D37350D0A4469616C5365636F6E64733D3132300D0A48616E67557050657263656E743D31300D0A48616E6755705365"
        $FileBin &= "636F6E64733D3132300D0A4F76657272696465507265663D31350D0A52656469616C417474656D7074733D330D0A52656469616C5365636F6E64733D36300D0A49646C65446973636F6E6E6563745365636F6E64733D300D0A52656469616C4F6E4C696E"
        $FileBin &= "6B4661696C7572653D300D0A43616C6C6261636B4D6F64653D300D0A437573746F6D4469616C446C6C3D0D0A437573746F6D4469616C46756E633D0D0A437573746F6D5261734469616C446C6C3D0D0A41757468656E7469636174655365727665723D30"
        $FileBin &= "0D0A53686172654D7346696C655072696E743D300D0A42696E644D734E6574436C69656E743D300D0A53686172656450686F6E654E756D626572733D310D0A476C6F62616C44657669636553657474696E67733D300D0A50726572657175697369746545"
        $FileBin &= "6E7472793D0D0A50726572657175697369746550626B3D0D0A507265666572726564506F72743D5050506F45342D300D0A5072656665727265644465766963653D57414E20E5BEAEE59E8BE7ABAFE58FA320285050504F45290D0A507265666572726564"
        $FileBin &= "4270733D300D0A5072656665727265644877466C6F773D300D0A50726566657272656450726F746F636F6C3D300D0A507265666572726564436F6D7072657373696F6E3D300D0A507265666572726564537065616B65723D310D0A507265666572726564"
        $FileBin &= "4D646D50726F746F636F6C3D300D0A507265766965775573657250773D310D0A50726576696577446F6D61696E3D300D0A5072657669657750686F6E654E756D6265723D300D0A53686F774469616C696E6750726F67726573733D310D0A53686F774D6F"
        $FileBin &= "6E69746F7249636F6E496E5461736B4261723D310D0A437573746F6D417574684B65793D2D310D0A417574685265737472696374696F6E733D3633320D0A5479706963616C417574683D310D0A49705072696F726974697A6552656D6F74653D310D0A49"
        $FileBin &= "70486561646572436F6D7072657373696F6E3D310D0A4970416464726573733D302E302E302E300D0A4970446E73416464726573733D302E302E302E300D0A4970446E7332416464726573733D302E302E302E300D0A497057696E73416464726573733D"
        $FileBin &= "302E302E302E300D0A497057696E7332416464726573733D302E302E302E300D0A497041737369676E3D310D0A49704E616D6541737369676E3D310D0A49704672616D6553697A653D313030360D0A4970446E73466C6167733D300D0A49704E4254466C"
        $FileBin &= "6167733D310D0A54637057696E646F7753697A653D300D0A557365466C6167733D300D0A4970536563466C6167733D300D0A4970446E735375666669783D0D0A0D0A4E4554434F4D504F4E454E54533D0D0A6D735F7365727665723D300D0A6D735F6D73"
        $FileBin &= "636C69656E743D300D0A0D0A4D454449413D726173746170690D0A506F72743D5050506F45342D300D0A4465766963653D57414E20E5BEAEE59E8BE7ABAFE58FA320285050504F45290D0A0D0A4445564943453D5050506F450D0A4C61737453656C6563"
        $FileBin &= "74656450686F6E653D300D0A50726F6D6F7465416C7465726E617465733D300D0A5472794E657874416C7465726E6174654F6E4661696C3D310D0A0D0A"
        Return Binary("0x" & $FileBin)
EndFunc   ;==>rasphone_pbk

邪恶海盗 发表于 2012-5-10 21:20:04

貌似见过的都是通过解压文件实现的...

或者你模拟键鼠操作吧...

haijie1223 发表于 2012-5-10 21:27:53

留个脚印。思考一下

tryhi 发表于 2012-5-10 23:16:49

貌似见过的都是通过解压文件实现的...

或者你模拟键鼠操作吧...
邪恶海盗 发表于 2012-5-10 21:20 http://www.autoitx.com/images/common/back.gif

怎样解压文件

ooxxgod 发表于 2012-5-10 23:21:16

图标?
那个快捷式 要想想了

zldfsz 发表于 2012-5-11 09:32:11

本帖最后由 zldfsz 于 2012-5-11 10:05 编辑

再次测试代码有问题,现删除

haijie1223 发表于 2012-5-11 09:34:58

回复 7# zldfsz


    楼主说了不要 指向rasphone的

zldfsz 发表于 2012-5-11 09:51:16

本帖最后由 zldfsz 于 2012-5-11 09:54 编辑

回复zldfsz
    楼主说了不要 指向rasphone的
haijie1223 发表于 2012-5-11 09:34 http://www.autoitx.com/images/common/back.gif
我不知道符不符合要求,因为我不是用宽带连接的,不过你右键-属性-查找目标就知道指向哪儿了。

zldfsz 发表于 2012-5-11 10:06:21

回复 8# haijie1223


    发现双击不能打开宽的链接窗口,删了

stdmis 发表于 2012-5-11 10:19:50

本帖最后由 stdmis 于 2012-5-11 10:22 编辑

这个问题解决过.其实可以上网查找,有这方面的解说.
网上找的.
http://www.dreams8.com/thread-13167-1-1.html

zldfsz 发表于 2012-5-11 10:27:25

回复 11# stdmis


    这个当然查过,不过你还是没注意楼主的要求

xx44t10 发表于 2012-5-11 11:26:22

貌似有的GHOST系统里面有个自动创建的。 好像是用rar打包的吧。里面有两文件。。你把它们转为au3写法。不就OK了么。。。呵呵。。我刚才找不到了。。。啊哦

dmqhcx88 发表于 2012-5-11 11:47:15

先用手动创建好再做成7Z自解压包通过AU3调用不知可不可以?

zldfsz 发表于 2012-5-11 13:56:29

本帖最后由 zldfsz 于 2012-5-11 14:41 编辑

看看这个行不行,在我的电脑上是可以的

Switch @OSVersion
        Case "WIN_7"
                $rasphone = @AppDataDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk" ;当前用户 Application Data 目录所在路径
        Case "WIN_XP"
                $rasphone = @AppDataCommonDir & "\Microsoft\Network\Connections\Pbk\rasphone.pbk"
EndSwitch
FileOpen($rasphone, 10)
FileWrite($rasphone,rasphone_pbk())
FileWrite(@DesktopCommonDir & "\宽带连接.lnk", PPPoE())

Func PPPoE()
        Local $FileBin=""
$FileBin &="4C0000000114020000000000C0000000000000468100000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000B00114001F50E04FD020EA3A6910A2D808002B30309D1400"
$FileBin &="2E002020EC21EA3A6910A2DD08002B30309D14007000C7AC07700232D111AAD200805FC1270E7201FF4E02000000FF5E0F3800000000D76A12BA6621D111B1D000805FC1270E254CF93345660941A9ED39AA79D671FE5F04000006000000000000002C00"
$FileBin &="0000E0000000000000000A0000000A00000022000000000000000C01000002000000BD5B265EDE8FA5630000570041004E002000AE5F8B57EF7AE353200028005000500050004F00450029000000140043003A005C0044006F00630075006D0065006E00"
$FileBin &="74007300200061006E0064002000530065007400740069006E00670073005C0041006C006C002000550073006500720073005C004100700070006C00690063006100740069006F006E00200044006100740061005C004D006900630072006F0073006F00"
$FileBin &="660074005C004E006500740077006F0072006B005C0043006F006E006E0065006300740069006F006E0073005C00500062006B005C00720061007300700068006F006E0065002E00700062006B000000254CF93345660941A9ED39AA79D671FE01000000"
$FileBin &="050000000000180F000000000000"
Return Binary("0x" & $FileBin)
EndFunc   ;==>PPPoE
Func rasphone_pbk()
Local $FileBin=""
$FileBin &="5BE5AEBDE5B8A6E8BF9EE68EA55D0D0A456E636F64696E673D310D0A547970653D350D0A4175746F4C6F676F6E3D300D0A55736552617343726564656E7469616C733D310D0A4469616C506172616D735549443D393532323635360D0A477569643D3235"
$FileBin &="3443463933333435363630393431413945443339414137394436373146450D0A4261736550726F746F636F6C3D310D0A56706E53747261746567793D300D0A4578636C7564656450726F746F636F6C733D300D0A4C6370457874656E73696F6E733D310D"
$FileBin &="0A44617461456E6372797074696F6E3D380D0A5377436F6D7072657373696F6E3D310D0A4E65676F74696174654D756C74696C696E6B416C776179733D300D0A536B69704E77635761726E696E673D300D0A536B6970446F776E4C6576656C4469616C6F"
$FileBin &="673D300D0A536B6970446F75626C654469616C4469616C6F673D300D0A4469616C4D6F64653D310D0A4469616C50657263656E743D37350D0A4469616C5365636F6E64733D3132300D0A48616E67557050657263656E743D31300D0A48616E6755705365"
$FileBin &="636F6E64733D3132300D0A4F76657272696465507265663D31350D0A52656469616C417474656D7074733D330D0A52656469616C5365636F6E64733D36300D0A49646C65446973636F6E6E6563745365636F6E64733D300D0A52656469616C4F6E4C696E"
$FileBin &="6B4661696C7572653D300D0A43616C6C6261636B4D6F64653D300D0A437573746F6D4469616C446C6C3D0D0A437573746F6D4469616C46756E633D0D0A437573746F6D5261734469616C446C6C3D0D0A41757468656E7469636174655365727665723D30"
$FileBin &="0D0A53686172654D7346696C655072696E743D300D0A42696E644D734E6574436C69656E743D300D0A53686172656450686F6E654E756D626572733D310D0A476C6F62616C44657669636553657474696E67733D300D0A50726572657175697369746545"
$FileBin &="6E7472793D0D0A50726572657175697369746550626B3D0D0A507265666572726564506F72743D5050506F45342D300D0A5072656665727265644465766963653D57414E20E5BEAEE59E8BE7ABAFE58FA320285050504F45290D0A507265666572726564"
$FileBin &="4270733D300D0A5072656665727265644877466C6F773D300D0A50726566657272656450726F746F636F6C3D300D0A507265666572726564436F6D7072657373696F6E3D300D0A507265666572726564537065616B65723D310D0A507265666572726564"
$FileBin &="4D646D50726F746F636F6C3D300D0A507265766965775573657250773D310D0A50726576696577446F6D61696E3D300D0A5072657669657750686F6E654E756D6265723D300D0A53686F774469616C696E6750726F67726573733D310D0A53686F774D6F"
$FileBin &="6E69746F7249636F6E496E5461736B4261723D310D0A437573746F6D417574684B65793D2D310D0A417574685265737472696374696F6E733D3633320D0A5479706963616C417574683D310D0A49705072696F726974697A6552656D6F74653D310D0A49"
$FileBin &="70486561646572436F6D7072657373696F6E3D310D0A4970416464726573733D302E302E302E300D0A4970446E73416464726573733D302E302E302E300D0A4970446E7332416464726573733D302E302E302E300D0A497057696E73416464726573733D"
$FileBin &="302E302E302E300D0A497057696E7332416464726573733D302E302E302E300D0A497041737369676E3D310D0A49704E616D6541737369676E3D310D0A49704672616D6553697A653D313030360D0A4970446E73466C6167733D300D0A49704E4254466C"
$FileBin &="6167733D310D0A54637057696E646F7753697A653D300D0A557365466C6167733D300D0A4970536563466C6167733D300D0A4970446E735375666669783D0D0A0D0A4E4554434F4D504F4E454E54533D0D0A6D735F7365727665723D300D0A6D735F6D73"
$FileBin &="636C69656E743D300D0A0D0A4D454449413D726173746170690D0A506F72743D5050506F45342D300D0A4465766963653D57414E20E5BEAEE59E8BE7ABAFE58FA320285050504F45290D0A0D0A4445564943453D5050506F450D0A4C61737453656C6563"
$FileBin &="74656450686F6E653D300D0A50726F6D6F7465416C7465726E617465733D300D0A5472794E657874416C7465726E6174654F6E4661696C3D310D0A0D0A"
Return Binary("0x" & $FileBin)
EndFunc
页: [1] 2 3
查看完整版本: 如何创建一个跟系统一样的宽带连接快捷方式