Sign in to follow this  
Followers 0
cypher175

Change IE Proxy Without Restart..??

9 posts in this topic

Is there anyway to have an autoit script change IE's Proxy settings while IE is in use, and then have IE start using that proxy without first having to restart IE.??

Share this post


Link to post
Share on other sites



Yes. Create a script that:

1 clicks on tools menu

2 clicks on internet options

3 Go to connections tab

4 clicks on LAN settings

5 Adjust the proxysettings you want

6 Appl and close all

7 refresh IE

That way you dont have to close the IE.

Share this post


Link to post
Share on other sites

so thats the only way then..??

you cant just change a few reg keys and refresh IE, you have to make a script to press buttons and stuff..??

Share this post


Link to post
Share on other sites

Is there anyway to have an autoit script change IE's Proxy settings while IE is in use, and then have IE start using that proxy without first having to restart IE.??

Func Set_Proxy($Address , $Port)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer" _
, "REG_SZ", $Address & ":" & $Port)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", _
"REG_DWORD", True)
EndFunc

Func Enables_Disable($BOOL)
;$BOOL True / False
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", _
"REG_DWORD", $BOOL)
EndFunc

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

yes, that changes IE's proxy, but dont you have to restart IE for it to actually work or be used though..??

Share this post


Link to post
Share on other sites

yes, that changes IE's proxy, but dont you have to restart IE for it to actually work or be used though..??

Hi,

Why don't you just try it?

If you have to, close iex and start it again automatically with AutoIT?

;-))

Stefan

Share this post


Link to post
Share on other sites

Yes. You will have to close IE and open it again for the changes to take effect.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

yes, that changes IE's proxy, but dont you have to restart IE for it to actually work or be used though..??

win32_Proxy—SetProxySetting Example

http://technet.microsoft.com/en-us/library/bb457096.aspx

SetProxySetting Method of the Win32_Proxy Class

http://msdn.microsoft.com/en-us/library/aa393589%28VS.85%29.aspx

I do not have proxy Address

Try this code

#Include <Array.au3>

Func SetProxySetting($myProxyServer , $myProxyPort)
$winmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}")
$win32_Proxy = $winmgmts.InstancesOf ("win32_Proxy")
Dim $Array[1]
for $Obj in $win32_Proxy
$result = $Obj.SetProxySetting($myProxyServer,$myProxyPort)
$Array[UBound($Array) - 1] = $result
ReDim $Array[UBound($Array) + 1]
next
ReDim $Array[UBound($Array) - 1]
Return $Array
EndFunc

Func GetProxySetting()
$winmgmts = ObjGet("winmgmts:{impersonationLevel=impersonate}")
$win32_Proxy = $winmgmts.InstancesOf ("win32_Proxy")
Dim $Array[1][2]
for $Obj in $win32_Proxy
$Array[UBound($Array) - 1][0] = $Obj.ProxyServer
$Array[UBound($Array) - 1][1] = $Obj.ProxyPortNumber
ReDim $Array[UBound($Array) + 1][2]
next
ReDim $Array[UBound($Array) - 1][2]
Return $Array
EndFunc
Edited by wolf9228

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

Hi Wolf,

Any chance for enabling /desabling (the checkboxes) between Autoconfig/AutoProxy/Proxyserver settings?

The SetProxySetting Method only deals with Proxy server. What if i want to change the "automatic configuration script" setting or toggle "auto detect settings"?

I couldnt find info about that in the win32_proxy class.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0