KXM 1 Posted May 18, 2005 (edited) So I'm not a great programer, nor do I have a large library of code to give back. But all the people on this forum are so helpful, and if this few lines of code can save some one a few lines of code, sweet. expandcollapse popup;=============================================================================== ; ; Description: :IE Proxy checker ; Parameter(s): $sProx_Port -String: Proxy AND Port IE: 123.123.123.123:1234 ; $bCheckBypass -[Opt] bool: check if 'Bypass proxy server for local addresses' is enabled. ; ==Default is disabled ; Return Value(s): 0 -Proxy isn't enabled ; 1 -Proxy dosen't match checked proxy ; 3 -Proxy is correct, but bypass is disabled. ; 4 -Success. Proxy matches, and bypass is checked. (if requested) ; Author(s): :Neil Layne <n dot layne at gmail> ; Example: _IEProxyCheck("168.0.0.1:8080", 1) ; Notes :Only checks for local user. ; ;=============================================================================== Func _IECheckProxy($sProx_Port, $bCheckBypass = 0) Local $sProxRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" Local $bProxSet = RegRead($sProxRegKey, "ProxyEnable") Local $sCurrentProx = RegRead($sProxRegKey, "ProxyServer") Local $sProxBypass = RegRead($sProxRegKey, "ProxyOverride") ;Check if prox is enabled, if not return 0 $bProxSet = RegRead($sProxRegKey, "ProxyEnable") If $bProxSet = 0 Then Return 0 ;check if prox matches request, if not return 1 If $sCurrentProx <> $sProx_Port Then Return 1 ;check if Bypass proxy is enabled, if requested. If $bCheckBypass = 1 Then If $sProxBypass <> "<local>" Then Return 3 Else Return 4 EndIf Else Return 4 EndIf EndFunc ;==>_IEProxyCheck ;=============================================================================== ; ; Description: :IE Proxy setter ; Parameter(s): $bAction -bool: 1=set proxy, 0=remove proxy ; $sPorx_Prot -string: proxy and port IE: 123.123.123.123:1234 ; $bBypass -[Opt] bool: 1=Turn on proxy bypassing on local. ; ==Default is disabled ; Requirement: :N/A ; Return Value(s): 1 -Success ; 0 -Faild ; Author(s): :Neil Layne <n dot layne at gmail> ; ;=============================================================================== Func _IESetProxy($bAction, $sProx_Port = 0, $bBypass = 0) Local $sProxRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings" ;If action is 0, remove the proxy. If $bAction <= 0 Then ;remove Proxy RegWrite($sProxRegKey, "ProxyEnable", "REG_DWORD", 0) RegDelete($sProxRegKey, "ProxyServer") RegDelete($sProxRegKey, "ProxyOverride") Return 1 EndIf If $sProx_Port = 0 Then Return 0 ElseIf Not IsString($sProx_Port) Then Return 0 Else RegWrite($sProxRegKey, "ProxyEnable", "REG_DWORD", 1) RegWrite($sProxRegKey, "ProxyServer", "REG_SZ", $sProx_Port) EndIf If $bBypass = 1 Then RegWrite($sProxRegKey, "ProxyOverride", "REG_SZ", "<local>") Return 1 EndFunc ;==>_IESetProxy Edit: made email froum unfriendly. Edited May 18, 2005 by KXM Share this post Link to post Share on other sites
busysignal 0 Posted May 19, 2005 This give me some ideas... Thanks. Share this post Link to post Share on other sites