Sign in to follow this  
Followers 0
FlorianF

Problem with embedded IE, how to recreate?

6 posts in this topic

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



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

Share this post


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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

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

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  
Followers 0