Sign in to follow this  
Followers 0
Shiinrei

Problem with _IECreate()

2 posts in this topic

#1 ·  Posted (edited)

Hello everyone!

 

First, I apologize for my English, I do my best!

 

I'm posting a topic here, because I have a problem with _IECreate().

I developed a program that allows to automatically authenticate an user to an hotspot. The script checks to a specified interval (every 10 seconds) if the user is logged in or not and for that, I use _IECreate ().

 

The problem is : The Internet Explorer window is supposed to be hidden for the user convenience, but unfortunately, sometimes she appears for no reason, while $ f_visible is set to 0, as shown in the documentation (I have Internet Explorer 10 & Windows 7). And what's more, when this happens, the window opens several times (because of the interval of 10 seconds) when it should not, because $ f_tryAttach is set to 1.

 

Maybe _IEErrorHandlerRegister is the cause of the problem, to be honest I do not really know how it works. The basic idea was to get more informations in case of problems.

 

I come here hoping to find help, because I'm racking my brains to find the source of the problem, but I can't find anything conclusive.

 

Thank you all for reading, here's is a simple example of how it work.

 

 

#include <IE.au3>

$oIEErrorHandler = ObjEvent("AutoIt.Error","MyErrFunc")
$Begin = TimerInit()

While 1

   If TimerDiff($Begin) > 10000 Then
      AutoLogin()
      $Begin = TimerInit()
   EndIf

WEnd

Func AutoLogin()

;-----------------------------------------------------------
; CONFIGURATION
; -----------------------------------------------------------

$Visibility = 0                               ; Window visibility (0 : Hidden / 1 : Visible)
$Url = "http://www.wikipedia.org/"            ; TEST Url
$oIE = _IECreate($Url, 1, $Visibility, 1, 1)
_IEErrorHandlerRegister("MyErrFunc")

EndFunc


Func MyErrFunc($oIEErrorHandler)

    Local $HexNumber
    Local $strMsg

    $HexNumber = Hex($oIEErrorHandler.Number, 8)
    $strMsg = "Error Number: " & $HexNumber & @CRLF
    $strMsg &= "WinDescription: " & $oIEErrorHandler.WinDescription & @CRLF
    $strMsg &= "Script Line: " & $oIEErrorHandler.ScriptLine & @CRLF
    MsgBox(0, "ERROR", $strMsg)
    SetError(1)

EndFunc
Edited by Shiinrei

Share this post


Link to post
Share on other sites



 # Problem solved by using _IECreateEmbedded() instead of _IECreate():bye:

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