Jump to content

IE.au3 WEnd ERROR


Vieri
 Share

Recommended Posts

Based on the odd behaviour, I'm guessing it is a security zone issue - IE is probably changing security zones to display the page and there are odd restrictions that are imposed - we saw this first in Vista. The ideas here may assist you: There are also some settings in Tools, Internet Options, Advanced, Security that you may try.

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

This is my new source code now:

#include <IE.au3>
_IEErrorHandlerRegister()
ShellExecute(@ProgramFilesDir & "Internet Exploreriexplore.exe", "http://10.215.144.66/temp/index_login.html", "", "", "@SW_HIDE")
If WinWait("HMAN intranet login", "", 30) = 0 Then
   Exit(1)
EndIf
$oIE = _IEAttach("HMAN intranet login")
$oForm = _IEFormGetObjByName ($oIE, "form1")
$oQuery = _IEFormElementGetObjByName ($oForm, "user")
_IEFormElementSetValue ($oQuery, $UserName)
$oQuery = _IEFormElementGetObjByName ($oForm, "password")
_IEFormElementSetValue ($oQuery, $UserPWD)
_IEFormSubmit ($oForm, 0)
_IELoadWait($oIE)

$hwnd = _IEPropertyGet($oIE, "hwnd")
WinSetState($hwnd, "", @SW_MINIMIZE)
WinSetState($hwnd, "", @SW_SHOW)

It's a bit of a hack and certainly not as neat as using _IECreate but it does solve my issue without touching each user's IE8 settings.

Thanks

Link to comment
Share on other sites

Just a last question regarding this issue. I'd like to use _IECreate whenever possible and only if it fails should I use the hack in my previous post.

Is this possible? I can't seem to make it work. I'm pasting the code below. How should I write the "MyErrFunc" function? Even if I set $IE_failed = True in that function and do a "return", it seems to go into an infinite loop and I never get to the part where I should "ShellExecute".

_IEErrorHandlerRegister("MyErrFunc")
$IE_failed = False
$oIE = _IECreate ($URL, 0, 0, 1)
If $IE_failed = True Then
ShellExecute(@ProgramFilesDir & "Internet Exploreriexplore.exe", $URL, "", "", "@SW_HIDE")
If WinWait("HMAN intranet login", "", 30) = 0 Then
   Exit(1)
EndIf
$oIE = _IEAttach("HMAN intranet login")
EndIf
Link to comment
Share on other sites

I'd suggest that you need to avoid _IELoadWait by setting the 4th parameter to _IECreate to 0. Check to see what kind of a return value you get from _IECreate in your failure scenario (it will return a fully accessible object when it succeeds). If you have determined that all is well, you can call _IELoadWait on your own. In the failing scenario, you'll likely need to use _IEAttach to get a handle to the browser instance, once it has morphed as a result of the security zone switching.

Dale

Edited by DaleHohm

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

  • 2 weeks later...

Hi,

I ve got the same strange problem. I need to set the settings for local network to protected mode to avoid an error in IE.au3.

It is this line (561 auf IE.au3)

While Not (String($o_object.document.readyState) = "complete" Or $o_object.document.readyState = 4 Or $f_Abort)
which seems to cause the problem.

Mega

post-7108-0-49701300-1331050625_thumb.pn

Edited by Xenobiologist

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

  • 4 weeks later...

Hello

I had the same problem but I fixed by changing IE.au3 and since, then no error

In original source

Local $status = __IEInternalErrorHandlerRegister()
If Not $status Then __IEErrorNotify("Warning", "_IELoadWait", _
   "Cannot register internal error handler, cannot trap COM errors", _
   "Use _IEErrorHandlerRegister() to register a user error handler")
Local $f_NotifyStatus = _IEErrorNotify() ; save current error notify status
_IEErrorNotify(False)
Sleep($i_delay)
;
Local $IELoadWaitTimer = TimerInit()
If $i_timeout = -1 Then $i_timeout = $__IELoadWaitTimeout
Select
  Case __IEIsObjType($o_object, "browser"); InternetExplorer

First, we execute this __IEInternalErrorHandlerRegister() who register an internal "com errors" function. It's Ok

BUT, when we execute __IEIsObjType, this function begins with __IEInternalErrorHandlerRegister() and ends with __IEInternalErrorHandlerDeRegister() which resets AutoIt Error becasue, only userFonction is registred

Func __IEInternalErrorHandlerDeRegister()
$oIEErrorHandler = ""
If $sIEUserErrorHandler <> "" Then
  $oIEErrorHandler = ObjEvent("AutoIt.Error", $sIEUserErrorHandler)
EndIf
Return SetError($_IEStatus_Success, 0, 1)
EndFunc

If we use $sIEUserErrorHandler,it's not sufficient because @ error is set after each function, so TimerDiff [Line 551 by example], reset @error

Therefore, test @ error as close to the error.

So the solution I implemented is that it

It register or reset, AutoIt Error function as first and last call

We will therefore, in the recording function, before checking if it's the first time and vice versa for reset

We will achieve this with a counter

Code of new version in PJ

Brgds

IE.zip

Link to comment
Share on other sites

  • 3 weeks later...

We have scripts that envoke "_IECreate". They have been running just fine for quite some time, both on XP / IE7 and W7 / IE8. It was last compiled using V3.3.6.1. In our case, we use the default settings of "_IECreate".

This week I updated my desktop from XP to W7 and re-installed all of my supporting tools. Earlier this month we downloaded the V3.3.8.1 version of AutoIt but this was the first time we've recompiled a script containing an "_IECreate" call. I made a very small change to the script - nothing regarding the "_IECreate" step - and recompiled, using the x86 option. Now we get the pop-up error and the same IE.au3 WEnd error.

The detective in me got going. Keeping in mind that the previous version of the EXE worked fine on my W7 box told me it had to be something with the V3.3.8.1 code specific to W7 and/or IE8. The same program compiled under V3.3.8.1 ran on my XP box with IE7 just fine - no problems whatsoever.

I rolled by W7 AutoIt version back to V3.3.6.1 and ran it via the "Go" option so as to capture any errors or warnings in the progress area at the bottom. With the "_IECREATE" default settings, it ran through but I noticed the AutoIT icon was still down in my system tray and the following warning was in the progress area:

"IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch"

I was able to do an Exit on the icon and it went away cleanly.

Now I started thinking, could AutoIt be waiting for a response from the browser? That's when I discovered the "_IECreate" switch '$f_wait', which specified whether to wait for the browser page to complete its load before returning; the default is to wait. I flipped this switch to "return immediately" and ran some tests.

My problem went completely away.

Under V3.3.6.1 the icon immediately disappeared from my system tray as expected. Under V3.3.8.1 I no longer got the error message and everything flowed smoothly.

This tells me that the AutoIt code stream has a problem with the "page load wait" functionality relative to the "_IECreate" call; I don't have the luxury to determine if it's W7 or IE8 that's the culprit. This would also correspond to the code failing on Line 560 in IE.au3; this section of the code appears to deal directly with the Load Wait Timer section.

So we have gone into our scripts that invoke "_IECreate" and set the '$f_wait' switch to 0, and all is fine. The engineers may want to revisit this code to determine what fix(es) need to be made.

Edited by SeattleDBA
Link to comment
Share on other sites

Recent changes in the AutoIt core (specifically, the fact that COM errors are no longer fatal) obviate the need for IE.au3 to use the internal error handler. The code is being rewritten to take advantage of this and will be available in the near future. Until this occurs, there remains the chance for this error as asynchronous streams can call the error handler.

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

  • 5 months later...

Sorry for posting in an old thread, but it was this one which gave me the clues to resolve the issue I was having with my script. Thanks to all the detective work, especially from Vieri!

The purpose of my script was simply to start a list of applications/urls on startup from an ini file. All was well, until I started using our internal intranet urls. This caused the Wend line 560 error in IE.au3. Since my users are not admins, I couldn't use the #RequireAdmin workaround (as posted in Dale's sig issue thread), and since I also wanted to be able to add tabs to the IE window with .Navigate2 I couldn't use SeatleDBA's suggestion of simply calling _IECreate without the wait flag.

My solution may not be the most elegant, but gets the job done. If anyone has an improvement (for instance do until), gladly accepted.

$oIE = _IECreate($appPath,0,1,0)
Sleep(100)
If ObjName($oIE) == "" Then
Local $i = 1
While 1
  $oIE = _IEAttach("", "instance", $i)
  If @error = $_IEStatus_NoMatch Then ExitLoop
  $i += 1
WEnd
$oIE = _IEAttach("", "instance", $i-1)
EndIf
_IELoadWait($oIE)

...in this way the $oIE object is valid for the next loop to open a new tab, if called.

Our environment is Windows 7, IE8.

Daniel

Link to comment
Share on other sites

  • 4 weeks later...

This is the final solution for

_IECreate issue & IE protected mode off

W7 IE 8 auto it V3.3.8.1

-the work around is

veri's solution was missing a couple of back slashes. This code you don't need to change any IE settings eg. set protected mode On

$url = "http://myintranet/Main/myPage.asp"
$win_title = "My Win title"
ShellExecute(@ProgramFilesDir & "\Internet Explorer\iexplore.exe", $url ) ;, "", "", "@SW_HIDE")
If WinWait($win_title, "", 30) = 0 Then
Exit(1)
EndIf
$oIE = _IEAttach($win_title)

ConsoleWrite("$Get " & _IEPropertyGet($oie, "locationurl") & @CRLF );
Edited by ozmike
Link to comment
Share on other sites

  • 5 months later...

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