Jump to content
Sign in to follow this  
FlorianF

Problem with embedded IE, how to recreate?

Recommended Posts

FlorianF

Hi all, i am making a script for reloading a youtube page with a different IP everytime it refreshes.

Everything is working but i got 1 problem, the registry settings are changed but the embedded IExplore still uses the old settings.

Only when i open the program again (and the embedded IExplore is created again) the settings are changed in the embedded IExplore.

Does anyone know how I can ensure that the settings are changed for the embedded IExplore in the program ITSELF without reopening it?

Here is the test code:

#include <ie.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Administrator\Documents\YoutubeIncreaseFlo\Form1.kxf
$Form1 = GUICreate("Test", 909, 586, 367, 134)
GUISetBkColor(0x000000)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ","192.33.90.69:3127")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1)

$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 8, 8, 892, 524)
$Start = GUICtrlCreateButton("Start", 414, 544, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
_IENavigate($oIE,"http://www.watismijnipadres.nl/")
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
            RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ","174.142.104.57:3128")
            sleep(500)
            _IENavigate($oIE,"http://www.watismijnipadres.nl/")
    EndSwitch
WEnd

You'll see that the IP adres has not changed by navigating to the site again. Does anyone know how I can fix this?

Thanks! :mellow:

Share this post


Link to post
Share on other sites
FlorianF

Maybe by recreating the IE object? But i dont know how..

Share this post


Link to post
Share on other sites
Tvern
This post explains how to change the proxy IE uses without restarting IE.

Share this post


Link to post
Share on other sites
FlorianF

Script:

#include <ie.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Users\Administrator\Documents\YoutubeIncreaseFlo\Form1.kxf
$Form1 = GUICreate("Test", 909, 586, 367, 134)
GUISetBkColor(0x000000)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ","192.33.90.69:3127")
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", 1)

$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, 8, 8, 892, 524)
$Start = GUICtrlCreateButton("Start", 414, 544, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
_IENavigate($oIE,"http://www.watismijnipadres.nl/")
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Start
            RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ","174.142.104.57:3128")
            $objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2\Applications\MicrosoftIE")
            $colIESettings3 = $objWMIService2.ExecQuery("Select * from MicrosoftIE_LANSettings")
            _IENavigate($oIE,"http://www.watismijnipadres.nl/")
    EndSwitch
WEnd

Error code:

C:\Users\Administrator\Documents\YoutubeIncreaseFlo\tester.au3 (28) : ==> Variable must be of type "Object".:
$colIESettings3 = $objWMIService2.ExecQuery("Select * from MicrosoftIE_LANSettings")
$colIESettings3 = $objWMIService2^ ERROR

What am I doing wrong?

Sorry for being noob :mellow:

Edited by FlorianF

Share this post


Link to post
Share on other sites
Tvern

Looks like the namespace "\root\CIMV2\Applications\MicrosoftIE" is (re)moved in win7 (and I assume Vista) It's bejond my capabilities to offer a solution though.

Share this post


Link to post
Share on other sites
FlorianF

Hmm does someone know which namespace is used in Windows 7 for IExplore?

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.