Jump to content

Closing Embedded IE and Reopening it


Recommended Posts

this is a example GUI

Example1()
Func Example1()
    Local $msg

    GUICreate("My GUI") ; will create a dialog box that when displayed is centered
    GUISetState(@SW_SHOW) ; will display an empty dialog box
    $btn = Guictrlcreatebutton("my btn", 10, 10 ,10, 20)
    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        if $msg = $btn then Example1() ;this is how you can reload a funtion
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd
    GUIDelete()
EndFunc   ;==>Example1
Link to comment
Share on other sites

If you are using the IE.au3 UDF, I think you can probably just use _IEQuit() and then re-create the object. Wait long enough and Dale is bound to come along with a definitive solution.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

_IEQuit cannot be used with this object. The object will be destroyed when its parent GUI is destroyed.

Zitbit's example is probably a good solution.

Edit: although I think you might need to make sure all instances of explorer are closed before reloading.

Edited by Tvern
Link to comment
Share on other sites

Zitbit's example is probably a good solution.

Edit: although I think you might need to make sure all instances of explorer are closed before reloading.

would it be easier just to use firefox?

I heard it has proxy support that is easy to implement

Link to comment
Share on other sites

There is a build-in autoit funtion to change the IE proxy. I'm not sure if there is a proxy function in FF.au3.

The IE object allows you to use COM on it directly. Firefox requires an addon to be installed so you can indirectly send it commands.

There are allot of people on this forum able to help you with any _IE question. I bet there are less people that know about FF.au3.

If you want to deploy your script on other PC's, atleast you can always count on IE being installed.

_IE might need a restart (did you test this). Firefox does not.

As much as I like FireFox, I think using it with autoit is a waste of time in all but very exceptional cases.

Link to comment
Share on other sites

i guess ill just stick with IE :mellow:

anyway, i recoded the part of the program that clicks the link and sets a new proxy. the problem is that when i tell it to close the IE window, it never does unless the program is the selected program. here is my code

Func button1()
$going=1
guictrlsetdata($status,"Running")
Do
        
        $delay=guictrlread($input3)
        $count=_GUICtrlEdit_GetLineCount($input2)
        $current=1
        $curprox=_GUICtrlEdit_GetLine($input2,$current)
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", "REG_DWORD", "1")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "REG_SZ",$curprox)
        $read=guictrlread($input1)
        $num=$stat2 + 1
        guictrlsetdata($stat2, $num)
        $nie=_IECreate($read)
        sleep(7000)
        _IEquit($nie)
        sleep($delay)
Until $going=0 or $current=$count
EndFunc

does anybody see anything wrong with this?

thanks

-rj

Edited by rvbfreak
Link to comment
Share on other sites

You can force an immediate sensing of proxy change with WMI. This was not my discovery... if you search the forum for WMI PROXY you'll find several references.

I believe this should do it for you:

$objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2\Applications\MicrosoftIE")
$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

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

Link to comment
Share on other sites

You can force an immediate sensing of proxy change with WMI. This was not my discovery... if you search the forum for WMI PROXY you'll find several references.

I believe this should do it for you:

$objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2\Applications\MicrosoftIE")
$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

Dale

I had faith that you would come along sooner or later. Good solution by the way.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

You still need to make your changes to the registry, then use WMI as above to make them go into effect.

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

Link to comment
Share on other sites

  • 1 year later...

You can force an immediate sensing of proxy change with WMI. This was not my discovery... if you search the forum for WMI PROXY you'll find several references.

I believe this should do it for you:

$objWMIService2 = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\CIMV2\Applications\MicrosoftIE")
$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

Dale

Getting the following error when I attempt to use the above code:

Variable must be of type "Object".:

$colIESettings3 = $objWMIService2.ExecQuery ("Select * from MicrosoftIE_LANSettings")

$colIESettings3 = $objWMIService2^ ERROR

Any idea why $collESettings3 would not be considered an object w/the above code?

Link to comment
Share on other sites

There is an issue with ObjGet with non-file monikers in the most recent beta. Did you try production release?

Dale

p.s. It is generally a bad idea to rekindle a long dormant thread. As well, this one's title does not relate to your question, so you are lucky anyone paid attention.

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

Link to comment
Share on other sites

Sorry bout that Dale. I was thinking this thread was old and rekindling might not be a good idea. I will search for the production release and if I have questions post a new thread.

That said, thanks for the reply--this has been vexing me.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...