supergg02 Posted November 6, 2005 Posted November 6, 2005 My goal is to change Internet explorer proxy on the fly without modifying Registry !is there a command line tools for that ?I tried by a wininet.dll call (InternetSetOption) but it is so complexe to implement this call without registry for current IE instance.please help
DaleHohm Posted November 7, 2005 Posted November 7, 2005 (edited) This is quite interesting... There is a whole new world here to explore... I was shocked to see this work...Dim $oWinmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}") Dim $Proxies = $oWinmgmts.InstancesOf("Win32_proxy") For $Proxy In $Proxies $Proxy.SetProxySetting ("myserver","myport" ) NextHere are the places I found clues:in microsoft.public.scripting.wshon msdnDaleEdit: Added referencesMy goal is to change Internet explorer proxy on the fly without modifying Registry !is there a command line tools for that ?I tried by a wininet.dll call (InternetSetOption) but it is so complexe to implement this call without registry for current IE instance.please help Edited November 7, 2005 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
supergg02 Posted November 7, 2005 Author Posted November 7, 2005 Dim $oWinmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}") Dim $Proxies = $oWinmgmts.InstancesOf("Win32_proxy") For $Proxy In $Proxies $Proxy.SetProxySetting ("myserver","myport" ) NextHere are the places I found clues:in microsoft.public.scripting.wshon msdnDaleEdit: Added referencesThinks for replay but this way make a registry modification and the goal is to to force IE to use a proxy without registry modification.An other problem is that tis code is not working when IE is loaded (it work only if you reload IE)
DaleHohm Posted November 7, 2005 Posted November 7, 2005 Thinks for replay but this way make a registry modification and the goal is to to force IE to use a proxy without registry modification.An other problem is that tis code is not working when IE is loaded (it work only if you reload IE)This was not true for me. I had IE running, ran this code, went to Tools -> Internet Options -> Connections -> Proxy Settings and the value for the proxy server and port showed the new value. I didn't test to see if they were actually being honored however.If this doesn't work for you, then the only other thing I have ever seen is changing the registry.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
supergg02 Posted November 7, 2005 Author Posted November 7, 2005 This was not true for me. I had IE running, ran this code, went to Tools -> Internet Options -> Connections -> Proxy Settings and the value for the proxy server and port showed the new value. I didn't test to see if they were actually being honored however.If this doesn't work for you, then the only other thing I have ever seen is changing the registry.Dalehere a way without registry and on the fly (for current session only) but with c++ (but my knowledge of c++ is very poor so i can not translate in autoit script)http://www.codeproject.com/internet/changeproxy1.aspthe autor deals about 3 methods and what i need is the last oneThinks aagin DaleHohm (I find your IE.au3 very interesting !)
LiHang Posted May 12, 2011 Posted May 12, 2011 here a way without registry and on the fly (for current session only) but with c++ (but my knowledge of c++ is very poor so i can not translate in autoit script) http://www.codeproject.com/internet/changeproxy1.asp the autor deals about 3 methods and what i need is the last one Thinks aagin DaleHohm (I find your IE.au3 very interesting !) Just got below code to refresh proxy settings. The method is to change proxy setting via regwrite as you like, then call wininet.dll to refresh it It works fine for me ;INTERNET_OPTION_SETTINGS_CHANGED DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 39, 'ptr', 0, 'dword', 0 ) ;INTERNET_OPTION_REFRESH DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 37, 'ptr', 0, 'dword', 0 )
dv8 Posted December 2, 2011 Posted December 2, 2011 LiHang, thank you for sharing this! It works like a charm! Anyone has any idea how to set up a proxy which needs authentication?I found this thread in another forum saying that if you set the ProxyServer registry key to "user:password@127.0.0.1:8080" it will work, but unfortunately it doesn't. Free Remote Desktop Software For Windows
rudi Posted December 2, 2011 Posted December 2, 2011 Hi.1.) the example you are giving is addressing a localhost proxy. You propably want to use the proxy on a different (server) host?2.)See this M$ KB article: "IE does not support user:pass@host:port in URLs:"Regards, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE!
KaFu Posted December 2, 2011 Posted December 2, 2011 2.)See this M$ KB article: "IE does not support user:pass@host:port in URLs:"See also this on how to re-enable it ... OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
dv8 Posted December 2, 2011 Posted December 2, 2011 1) The example I'm giving is just to illustrate the syntax I'm trying to use, suggested in the thread I mentioned. It does not contain the actual values that I'm using when testing it. 2) As I said, this is set in the registry for the ProxyServer registry key in "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings". I don't believe it is passed in the URL. And here is my question again: Anyone has any idea how to set up a proxy which needs authentication? Free Remote Desktop Software For Windows
dv8 Posted December 2, 2011 Posted December 2, 2011 Thanks KaFu! I'll give this a try and post the results here Free Remote Desktop Software For Windows
dv8 Posted December 2, 2011 Posted December 2, 2011 Unfortunately this does not work for me. Here is what I'm doing: #include<IE.au3> $ProxyKey="HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings" #include <ie.au3> RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",0) RegWrite($ProxyKey,"ProxyServer","REG_SZ","user:pass@xxx.xxx.xxx.xxx:port") RegWrite($ProxyKey,"ProxyEnable","REG_DWORD","1") DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 39, 'ptr', 0, 'dword', 0 ) ;INTERNET_OPTION_SETTINGS_CHANGED DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 37, 'ptr', 0, 'dword', 0 ) ;INTERNET_OPTION_REFRESH $oIE2=_IECreate("http://www.whatismyip.com/") Sleep(10000) RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE","iexplore.exe","REG_DWORD",1) RegWrite($ProxyKey,"ProxyServer","REG_SZ","") RegWrite($ProxyKey,"ProxyEnable","REG_DWORD","0") DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 39, 'ptr', 0, 'dword', 0 ) ;INTERNET_OPTION_SETTINGS_CHANGED DllCall( 'wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 37, 'ptr', 0, 'dword', 0 ) ;INTERNET_OPTION_REFRESH The user:pass@xxx.xxx.xxx.xxx:port here is for illustration only. I'm putting real data when testing it, but unfortunately can't share this data here. I'll appreciate any ideas on how I can make this work. Free Remote Desktop Software For Windows
KaFu Posted December 2, 2011 Posted December 2, 2011 (edited) Quite hard without a testing environment ... what about this? #include<IE.au3> $sProxy = "xxx.xxx.xxx.xxx:port" $sUserPass = "user:pass" $ProxyKey = "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternet Settings" RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE", "iexplore.exe", "REG_DWORD", 0) RegWrite($ProxyKey, "ProxyServer", "REG_SZ", $sProxy) RegWrite($ProxyKey, "ProxyEnable", "REG_DWORD", "1") DllCall('wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 39, 'ptr', 0, 'dword', 0) ;INTERNET_OPTION_SETTINGS_CHANGED DllCall('wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 37, 'ptr', 0, 'dword', 0) ;INTERNET_OPTION_REFRESH $oIE = _IECreate("http://" & $sUserPass & " @ " & $sProxy) _IENavigate($oIE, "http://www.whatismyip.com/") RegWrite("HKEY_CURRENT_USERSoftwareMicrosoftInternet ExplorerMainFeatureControlFEATURE_HTTP_USERNAME_PASSWORD_DISABLE", "iexplore.exe", "REG_DWORD", 1) RegWrite($ProxyKey, "ProxyServer", "REG_SZ", "") RegWrite($ProxyKey, "ProxyEnable", "REG_DWORD", "0") DllCall('wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 39, 'ptr', 0, 'dword', 0) ;INTERNET_OPTION_SETTINGS_CHANGED DllCall('wininet.dll', 'uint', 'InternetSetOption', 'ptr', 0, 'dword', 37, 'ptr', 0, 'dword', 0) ;INTERNET_OPTION_REFRESH Edited December 2, 2011 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16)
dv8 Posted December 2, 2011 Posted December 2, 2011 Still not working for me. Free Remote Desktop Software For Windows
Juvigy Posted December 6, 2011 Posted December 6, 2011 is this working? HttpSetProxy(2, "proxy:port", "username", "password") ConsoleWrite(BinaryToString(InetRead("http://www.google.com")))
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now