Jump to content

Embedded IE in a simple GUI, connection issue


 Share

Recommended Posts

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
Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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

Link to comment
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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
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...