Sign in to follow this  
Followers 0
Concrete

Embedded IE in a simple GUI, connection issue

5 posts in this topic

Hi there,

I'm new. I've been attempting to create a simple GUI with IE embedded as a tool for colleagues. It navigates to a specific webpage upon starting.

The problem is that it can not connect to any web page when I'm running it on the office network, since we're using an automatic proxy configuration script (I'm assuming). It connects fine when running it on my Win7 home computer which does not have any special network restrictions.

Is there a way to make the embedded IE connect to through the proxy as though it was simply a new session of IE? I'm not sure I'm making enough sense, I only have a superficial understanding of networks and proxies.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_icon=webclock.ico
#AutoIt3Wrapper_Res_Icon_Add=webclock.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
_IEErrorHandlerRegister()
Local $ie = _IECreateEmbedded()
GUISetIcon("Icon.ico")
GUICreate("Web Clock", 400, 300, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN, $WS_EX_TOPMOST)
GUICtrlCreateObj($ie, 2, 2, 398, 398)
GUISetState() ;Show GUI
_IENavigate($ie, "http://www.autoitscript.com")
_IEPropertySet($ie, "addressbar", False)
_IEPropertySet($ie, "menubar", False)
_IEPropertySet($ie, "statusbar", False)
_IEPropertySet($ie, "toolbar", False)
_IELoadWait($ie)
$ie.document.body.scroll = "NO"
$ie.document.body.style.overflow = "hidden"
While 1
    Local $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        EndSelect
WEnd
GUIDelete()
Exit

Share this post


Link to post
Share on other sites



From my office network this works just fine. What version of the IE do you use?

What you need is some kind of error handling in your script. Check @error after each _IE* command and pop up a MsgBox or whatever if @error <> 0.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

We're using IE8.

I'm afraid that I've not gotten to the point of understanding error handling yet, however the fact that it's running and connecting perfectly outside of the office network could imply that there's a credentials issue, perhaps? Is there a way to ensure that the username/pw dialogue pops up?

Share this post


Link to post
Share on other sites

I'm afraid that I've not gotten to the point of understanding error handling yet ...

Use this modified script and you will get an error code of the failing command. This code is documented in the AutoIt help file:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#AutoIt3Wrapper_icon=webclock.ico
#AutoIt3Wrapper_Res_Icon_Add=webclock.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <IE.au3>
#include <WindowsConstants.au3>
_IEErrorHandlerRegister()
Local $ie = _IECreateEmbedded()
GUISetIcon("Icon.ico")
GUICreate("Web Clock", 400, 300, _
        (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, _
        $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN, $WS_EX_TOPMOST)
GUICtrlCreateObj($ie, 2, 2, 398, 398)
GUISetState() ;Show GUI
_IENavigate($ie, "http://www.autoitscript.com")
If @error <> 0 Then MsgBox(16, @ScriptName, "_IENavigate: @error = " & @error)
_IEPropertySet($ie, "addressbar", False)
_IEPropertySet($ie, "menubar", False)
_IEPropertySet($ie, "statusbar", False)
_IEPropertySet($ie, "toolbar", False)
_IELoadWait($ie)
If @error <> 0 Then MsgBox(16, @ScriptName, "_IELoadWait: @error = " & @error)
$ie.document.body.scroll = "NO"
$ie.document.body.style.overflow = "hidden"
While 1
    Local $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        EndSelect
WEnd
GUIDelete()
Exit

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thank you.

I've tested a bit and have confirmed that it's the problem with the username/password authentication dialogue box not appearing. I've been looking through the docs for IE.au3, but I'm still mystified. I'm not sure how to make it appear when it's embedded, it does so fine when using _IECreate(), but I need to have it embedded. And every time the web page is loaded, it should prompt for user/pw, as it expires whenever IE is restarted.

Edited by Concrete

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