绿色风's Blog
专注AutoIT(Au3)
  • 首页
  • 流●年
  • 笔●记
    • 学习随记
    • 源码示例
  • 脚●本
    • UDF(收集)
    • 工作室UDF
    • 工具●教程
    • 教程之GDI
  • 作●品
  • 下●载
  • 情怀ExcelTip
12月202016

AU3真正的 修改IE 代理 即使生效·

作者:绿色风   发布:2016-12-20 12:22 Tuesday   分类:源码示例   阅读:5836次   评论:1条  

111111.png

```#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Global $radHome, $radGehl, $guiProxy, $proxyAutoSettings, $IEVersion, $chkBxAutoDetect, $chkBxAutoConfig, $chkBxProxyLan, $inpProxyServer Global $inpPort, $chkBxBypass, $inpBypassAdd, $inpAutoConfig, $proxyAutoTemp Global $CONSTKEYPROXY = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" Global $CONSTKEYHOME = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" Global $CONSTKEYAUTO = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" Global $CONSTKEYIEVER = "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" Global $AppTitle = "Proxy Changer" $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer") $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable") $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride") $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page") $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version") $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings") $IEVersion = StringLeft($proxyGetVersion, 1) $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl") If $autoConfigUrl = -1 Then $autoConfigUrl = "" EndIf $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2) Switch $proxyAutoTemp Case "03" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED Case "0B" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_UNCHECKED Case "0F" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_CHECKED Case "07" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_CHECKED Case "01" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED Case "09" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_UNCHECKED Case "0D" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_CHECKED Case "05" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_CHECKED Case Else $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED EndSwitch #Region ### START Koda GUI section ### Form=c:\my documents\autoit scripts\koda_2008-10-03\forms\form1.kxf $guiProxy = GUICreate($AppTitle, 499, 507, 231, 168) GUISetOnEvent($GUI_EVENT_CLOSE, "_Events") GUISetOnEvent($GUI_EVENT_MINIMIZE, "_Events") GUISetOnEvent($GUI_EVENT_RESTORE, "_Events") $grpAuto = GUICtrlCreateGroup("自动配置", 24, 16, 441,115) $chkBxAutoDetect = GUICtrlCreateCheckbox("自动检测设置", 48, 48, 201, 17) GUICtrlSetState(-1, $autoDetect) $chkBxAutoConfig = GUICtrlCreateCheckbox("使用自动配置脚本", 48, 72, 209, 17) GUICtrlSetState(-1, $autoConfig) GUICtrlSetOnEvent(-1, "_AutoConfig_Check") $inpAutoConfig = GUICtrlCreateInput("", 88, 96, 209, 21) GUICtrlSetData(-1, $autoConfigUrl) GUICtrlCreateGroup("", -99, -99, 1, 1) $grpProxy = GUICtrlCreateGroup("代理服务器", 24, 138, 441, 185) $chkBxProxyLan = GUICtrlCreateCheckbox("使用代理服务器", 64, 160, 193, 17) GUICtrlSetOnEvent(-1, "_ProxyLan_Check") $lblProxyAddress = GUICtrlCreateLabel("Address:", 64, 188, 45, 17) $inpProxyServer = GUICtrlCreateInput("", 124, 184, 137, 21) $lblPort = GUICtrlCreateLabel("Port:", 298, 188, 26, 17) $inpPort = GUICtrlCreateInput("", 336, 184, 73, 21) $chkBxBypass = GUICtrlCreateCheckbox("对于本地地址不使用代理服务器", 64, 222, 241, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $inpBypassAdd = GUICtrlCreateEdit("", 80, 270, 297,42, $ES_MULTILINE) GUICtrlCreateGroup("", -99, -99, 1, 1) $btnDefaults = GUICtrlCreateButton("检索系统设置", 70, 424, 150, 33, 0) GUICtrlSetOnEvent(-1, "_DefaultButton") $Button2 = GUICtrlCreateButton("使用以上设置", 270, 424, 150, 33, 0) GUICtrlSetOnEvent(-1, "_AsShown") If $proxyEnable = 1 Then $proxyPorttemp = StringSplit($proxyRegServer, ":") GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED) GUICtrlSetData($inpProxyServer, $proxyPorttemp[1]) GUICtrlSetData($inpPort, $proxyPorttemp[2]) GUICtrlSetState($chkBxBypass, $GUI_CHECKED) GUICtrlSetData($inpBypassAdd, $proxyOverride) GUICtrlSetState($radGehl, $GUI_CHECKED) Else GUICtrlSetState($radHome, $GUI_CHECKED) EndIf _AutoConfig_Check() ; this will update initial state based on current values _ProxyLan_Check() ; this will update initial state based on current values GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func ProxySetup() $proxyRegServer = RegRead($CONSTKEYPROXY, "ProxyServer") $proxyEnable = RegRead($CONSTKEYPROXY, "ProxyEnable") $proxyOverride = RegRead($CONSTKEYPROXY, "ProxyOverride") $proxyRegHomePage = RegRead($CONSTKEYHOME, "Start Page") $proxyGetVersion = RegRead($CONSTKEYIEVER, "Version") $proxyAutoSettings = RegRead($CONSTKEYAUTO, "DefaultConnectionSettings") $IEVersion = StringLeft($proxyGetVersion, 1) $autoConfigUrl = RegRead($CONSTKEYPROXY, "AutoConfigUrl") If $autoConfigUrl = -1 Then $autoConfigUrl = "" EndIf $proxyAutoTemp = StringMid($proxyAutoSettings, 19, 2) Switch $proxyAutoTemp Case "03" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED Case "0B" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_UNCHECKED Case "0F" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_CHECKED Case "07" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_CHECKED Case "01" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED Case "09" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_UNCHECKED Case "0D" $autoDetect = $GUI_CHECKED $autoConfig = $GUI_CHECKED Case "05" $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_CHECKED Case Else $autoDetect = $GUI_UNCHECKED $autoConfig = $GUI_UNCHECKED EndSwitch If $proxyEnable = 1 Then $proxyPorttemp = StringSplit($proxyRegServer, ":") GUICtrlSetState($chkBxProxyLan, $GUI_CHECKED) GUICtrlSetData($inpProxyServer, $proxyPorttemp[1]) GUICtrlSetData($inpPort, $proxyPorttemp[2]) GUICtrlSetState($chkBxBypass, $GUI_CHECKED) GUICtrlSetData($inpBypassAdd, $proxyOverride) GUICtrlSetState($radGehl, $GUI_CHECKED) Else GUICtrlSetState($radHome, $GUI_CHECKED) EndIf _AutoConfig_Check() ; this will update initial state based on current values _ProxyLan_Check() ; this will update initial state based on current values EndFunc Func _Events() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_MINIMIZE Case $GUI_EVENT_RESTORE Case Else EndSwitch EndFunc ;==>_Events Func _DefaultButton() If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then $proxyAutoTemp = "03" ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then $proxyAutoTemp = "01" EndIf Select Case BitAND(GUICtrlRead($radHome), $GUI_CHECKED) RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000000") DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) Case BitAND(GUICtrlRead($radGehl), $GUI_CHECKED) $proxyAutoLeft = StringLeft($proxyAutoSettings, 18) $proxyAutoRight = StringMid($proxyAutoSettings, 21) $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite) RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", "00000001") RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", "proxy:80") RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", "192.168.*;<local>") DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) EndSelect ;GUIDelete($guiProxy) ProxySetup() EndFunc ;==>_DefaultButton Func _AsShown() ;ProxySetup() Select Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED $autoConfigUrlWrite = "" If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then $proxyAutoTemp = "03" ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then $proxyAutoTemp = "01" EndIf Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_UNCHECKED $autoConfigUrlWrite = "" If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then $proxyAutoTemp = "0B" ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then $proxyAutoTemp = "09" EndIf Case GUICtrlRead($chkBxAutoDetect) = $GUI_CHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig) If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then $proxyAutoTemp = "0F" ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then $proxyAutoTemp = "0D" EndIf Case GUICtrlRead($chkBxAutoDetect) = $GUI_UNCHECKED And GUICtrlRead($chkBxAutoConfig) = $GUI_CHECKED $autoConfigUrlWrite = GUICtrlRead($inpAutoConfig) If $proxyAutoTemp = "03" Or $proxyAutoTemp = "0B" Or $proxyAutoTemp = "0F" Or $proxyAutoTemp = "07" Then $proxyAutoTemp = "07" ElseIf $proxyAutoTemp = "01" Or $proxyAutoTemp = "09" Or $proxyAutoTemp = "0D" Or $proxyAutoTemp = "05" Then $proxyAutoTemp = "05" EndIf Case Else EndSelect If GUICtrlRead($chkBxProxyLan) = $GUI_CHECKED Then $proxyEnableWrite = "00000001" $proxyServer = GUICtrlRead($inpProxyServer) & ":" & GUICtrlRead($inpPort) $proxyOverride = GUICtrlRead($inpBypassAdd) & ";<local>" $proxyAutoLeft = StringLeft($proxyAutoSettings, 18) $proxyAutoRight = StringMid($proxyAutoSettings, 21) $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite) RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite) RegWrite($CONSTKEYPROXY, "ProxyServer", "REG_SZ", $proxyServer) RegWrite($CONSTKEYPROXY, "ProxyOverride", "REG_SZ", $proxyOverride) RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite) MsgBox(1,"设置","成功") ElseIf GUICtrlRead($chkBxProxyLan) = $GUI_UNCHECKED Then $proxyEnableWrite = "00000000" $proxyAutoLeft = StringLeft($proxyAutoSettings, 18) $proxyAutoRight = StringMid($proxyAutoSettings, 21) $proxyAutoWrite = $proxyAutoLeft & $proxyAutoTemp & $proxyAutoRight RegWrite($CONSTKEYAUTO, "DefaultConnectionSettings", "REG_BINARY", $proxyAutoWrite) RegWrite($CONSTKEYPROXY, "ProxyEnable", "REG_DWORD", $proxyEnableWrite) RegWrite($CONSTKEYPROXY, "AutoConfigUrl", "REG_SZ", $autoConfigUrlWrite) MsgBox(1,"设置","取消设置") EndIf $s=DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0) MsgBox(1,@error,$s) ;GUIDelete($guiProxy) ;ProxySetup() EndFunc ;==>_AsShown Func _AutoConfig_Check() Local $IsChecked = GUICtrlRead($chkBxAutoConfig) If $IsChecked = 1 Then GUICtrlSetState($inpAutoConfig, $GUI_ENABLE) Else ; $IsChecked = 4 GUICtrlSetState($inpAutoConfig, $GUI_DISABLE) EndIf EndFunc ;==>_AutoConfig_Checked Func _ProxyLan_Check() $IsChecked = GUICtrlRead($chkBxProxyLan) If $IsChecked = 1 Then GUICtrlSetState($inpBypassAdd, $GUI_ENABLE) GUICtrlSetState($inpProxyServer, $GUI_ENABLE) GUICtrlSetState($inpPort, $GUI_ENABLE) GUICtrlSetState($chkBxBypass, $GUI_ENABLE) Else GUICtrlSetState($inpBypassAdd, $GUI_DISABLE) GUICtrlSetState($inpProxyServer, $GUI_DISABLE) GUICtrlSetState($inpPort, $GUI_DISABLE) GUICtrlSetState($chkBxBypass, $GUI_DISABLE) EndIf EndFunc ;==>_ProxyLan_Clicked```





本文固定链接: http://www.jianyiit.com/post-250.html

blogger
该日志由 绿色风 于2016-12-20 12:22 Tuesday发表在 源码示例 分类下。
版权所有:《绿色风's Blog》 → 《AU3真正的 修改IE 代理 即使生效·》;
除特别标注,本博客很多文章均为原创. 互联分享,尊重版权,转载请以链接形式标明本文地址;
本文标签:

扫描二维码,在手机上阅读
上一篇::播放windows\Media文件夹下的wav波形文件
下一篇:AU3 图片读入数组后输出回图片文件

热门文章

相关文章

  • pubmed 文献应助 抢单源码
  • Au3定时关机精灵(仿定时强制关机精力1.0)含源码
  • Au3[位置不固定]验证码识别例子
  • 还记得小时候玩的16宫格游戏版吗
  • 获取打开的IE窗口的句柄与TAB标题
评论列表 ↓
呦,果断人中龙凤! 黄瓜哥      2019-03-28 22:21 @回复
老弟,这段代码如何检测socks5代理速度!
取消回复

发表评论

亲,头像对么?

44 + 54 =

提交中,请稍候……


木有头像就木JJ啦!还木有头像吗?点这里申请属于你的个性Gravatar头像吧!


    站点统计
    • 运行时间: 20254 天
    • 日志总数: 365 篇
    • 评论数量: 7252 条
    • 微语数量: 6 条
    • 附件总量: 388 件
  • 逝出的青春

  • 打赏"绿色风"



      扫码关注本站公众号 可搜本站内容

  • Autoit V3 脚本交流群

      常驻群1:905774875
      常驻群2:40672266


  • 链接

    • AU3中文论坛
    • Excel资料库
    • 完美者博客
    • 顺网小哥'S Blog
    • 猛牛哥的博客
    • 网吧系统下载
  • 分类

    • 流●年(66)
    • 笔●记(0)
    • 脚●本(0)
    • 作品(21)
    • 学习随记(51)
    • 源码示例(68)
    • UDF(收集)(26)
    • 工作室UDF(30)
    • 工具●教程(62)
    • 教程之GDI(24)
Copyright © 2013 绿色风's Blog. Powered by emlog. Theme by 射雕天龙. 鄂ICP备2021011689号-1 鄂公网安备42102302000078号 sitemap