Jump to content
Sign in to follow this  
enaiman

Any way to force IE to reload Environment?

Recommended Posts

enaiman

I'm working on a script to turn on/off the "Auto Configuration Script" in IE.

So far this is what I have:

$pac_url = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","AutoConfigURL")
Switch $pac_url
    Case "http://proxy.company.xyz/auto.pac"
        MsgBox (0, "Proxy State", "Proxy is ON. URL = "&$pac_url, 2)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","AutoConfigURL", "REG_SZ", "")
        If @error <> 0 Then MsgBox(0, "error - empty - ", "error code = "&@error) 
    Case ""
        MsgBox (0, "Proxy State", "Proxy is OFF.", 2)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings","AutoConfigURL", "REG_SZ", "http://proxy.company.xyz/auto.pac")
        If @error <> 0 Then MsgBox(0, "error - set url - ", "error code = "&@error)
    Case Else
        MsgBox (0, "Proxy State", "Proxy state is unknown "&$pac_url, 2)
EndSwitch

This is quite easy to do and it works well. However the browser need to be restarted in order to "see" the changes.

I'm not happy to restart the browser so I would be grateful if some1 can find a way to "Force" IE to reread the settings.

Been searching the web for a solution and haven't found one yet.

Also I tried EnvUpdate() but it doesn't work.

Found something about WM_SETTINGCHANGE but I don't know if that would work and how to use it.

Thank you,


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
DaleHohm

Set IE Registry options immediately:

DllCall('WININET.DLL', 'long', 'InternetSetOption', 'int', 0, 'long', 39, 'str', 0, 'long', 0)

I can't take credit for this... see here:

From: http://www.autoitscript.com/forum/index.ph...2&hl=single

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

Share this post


Link to post
Share on other sites
enaiman

That is .... That is ... BRILLIANT :)

DaleHohm - you have just earned my eternal gratitude :(

Thank you gazzilion times :D

-- Cheer --


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.