Sign in to follow this  
Followers 0

IE.au3 WEnd ERROR


31 posts in this topic

Posted

Each time I run the Autoit script below, I get any of the following 2 error messages:

message 1:

Line 1124 AutoIt3\Include\IE.au3:
Local $o_col = $o_object.document.forms.item($s_Name)
Local $o_col = $o_object.document^ ERROR
Error: The requested action with this object has failed.

message 2:

Line 560 AutoIt3\Include\IE.au3:
WEnd
WEnd^ ERROR
Error: The requested action with this object has failed.

AutoIt Version: 3.3.8.1

Windows 7

IE 8

Autoit script:

#include <IE.au3>
$oIE = _IECreate("http://10.215.144.66/apps/portal/index_login.php")
$oForm = _IEFormGetObjByName($oIE, "form1")
$oUser = _IEFormElementGetObjByName($oForm, "user")
$oPasswd = _IEFormElementGetObjByName($oForm, "password")
$user = "user"
$passwd = "password"
_IEFormElementSetValue($oUser, $user)
_IEFormElementSetValue($oPasswd, $passwd)

LAN web page ("http://10.215.144.66/apps/portal/index_login.php"):

<html>
<body>
<table width="100%" border="0" height="90%">
  <tr>
    <td valign="top" width="120" bgcolor="#CCCCCC" height="100%">
	  <div align="right">
	    <form name="form1" id="form1" method="post" action="https://webapps.domain.org/apps/portal/index.php">
		  <table border="0" bordercolor="#003399" width="100%" cellspacing="0" cellpadding="0">
		    <tr bgcolor="#003399">
			  <td colspan="2">
			    User
			  </td>
		    </tr>
		    <tr>
			  <td>
				  <br>&#160;User
			  </td>
			  <td>
				  <br><input type="text" name="user" id="user">
			  </td>
	 </tr>
	 <tr>
	   <td>
				  &#160;Password
			  </td>
			  <td>

				  <input type="password" name="password" id="password">

			  </td>			 
		    </tr>
	 <tr>
	   <td align="right" colspan="2">
   <input type="submit" name="btsubmit" value="Enter">
			  </td>
		    </tr>
		 
		  </table>
		  </form>
  
	    </div>
    </td>
  </tr>
</table>
</body>
</html>

Any ideas?

Thanks

Vieri

Share this post


Link to post
Share on other sites



Posted

Add _IEErrorHandlerRegister() to your code and see what messages you receive then.

Dale

Share this post


Link to post
Share on other sites

Posted

Thanks Dale,

I added the following to the above code example:

_IEErrorHandlerRegister("MyErrFunc")
Func MyErrFunc()
    ; Important: the error object variable MUST be named $oIEErrorHandler
    Local $ErrorScriptline = $oIEErrorHandler.scriptline
    Local $ErrorNumber = $oIEErrorHandler.number
    Local $ErrorNumberHex = Hex($oIEErrorHandler.number, 8)
    Local $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2)
    Local $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2)
    Local $ErrorSource = $oIEErrorHandler.Source
    Local $ErrorHelpFile = $oIEErrorHandler.HelpFile
    Local $ErrorHelpContext = $oIEErrorHandler.HelpContext
    Local $ErrorLastDllError = $oIEErrorHandler.LastDllError
    Local $ErrorOutput = ""
    $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR
    $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR
    $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR
    $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR
    $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR
    $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR
    $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR
    $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR
    $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR
    $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError
    MsgBox(0, "COM Error", $ErrorOutput)
    SetError(1)
    Return
EndFunc   ;==>MyErrFunc

When I run the script I get the following message, over and over again:

--> COM Error Encountered in script.au3
----> $ErrorScriptline = 560
----> $ErrorNumberHex = 800706B5
----> $ErrorNumber = -2147023179
----> $ErrorWinDescription = Unknown interface.
----> $ErrorDescription =
----> $ErrorSource =
----> $ErrorHelpFile =
----> $ErrorHelpContext = 0
----> $ErrorLastDllError = 0

I don't know how to interpret the error message "unknown interface".

Thanks

Share this post


Link to post
Share on other sites

Posted

Well, start by looking at what is at line 560 in your script.

Dale

Share this post


Link to post
Share on other sites

Posted

There's no such line... My script is the one posted above (just 9 lines of code).

Line 560 probably refers to the included IE.au3 file.

Share this post


Link to post
Share on other sites

Posted (edited)

#include <IE.au3>
$oIE = _IECreate("[url="http://10.215.144.66/apps/portal/index_login.php"]http://10.215.144.66/apps/portal/index_login.php[/url]")[/font]
[font=monospace]_IEErrorHandlerRegister()[/font]
[font=monospace]$oForm = _IEFormGetObjByName($oIE, "form1")
$oUser = _IEFormElementGetObjByName($oForm, "user")
$oPasswd = _IEFormElementGetObjByName($oForm, "password")
$user = "user"
$passwd = "password"
_IEFormElementSetValue($oUser, $user)
_IEFormElementSetValue($oPasswd, $passwd)

This is what I had intended you do after my first post. Please run this instead.

There is likely some odd processing going on on that webpage (AJAX updates or page redirects or something). What you will need to do depends on what is happening... dig in and see what you learn.

Dale

Edited by DaleHohm

Share this post


Link to post
Share on other sites

Posted

It looks like it has something to do with IE8's security settings.

Since I'm trying to _IECreate an intranet web page, the browser is opened with the setting "Protected mode: disabled".

If I enable "protected mode" for the "local network" then the AuotIT script works as expected...

So I have another problem now: how do I make sure that the IE browser has "protected mode" enabled for the intranet zone before calling _IECreate()?

Or can IE.au3 do that for me?

Better yet, make _IECreate work even if IE8 has "protected mode" disabled.

Share this post


Link to post
Share on other sites

Posted

By the way, I don't know why enabling or disabling "protected mode" should actually make a difference as far as opening a simple web page (no activeX, no nothing), but it does with autoit's IECreate.

Share this post


Link to post
Share on other sites

Posted

It's not easy to wade through, but Microsoft has published extensive information about protected mode and the other security features of IE... you'll need to dig in, I think. Also, please don't ignore my suggestion to run the code above.

Dale

Share this post


Link to post
Share on other sites

Posted

I actually DID run it (with "protected mode" disabled) and got the following error messages (yes, randomly....):

Line 625 (File "C:\Program Files\AutoIt3\Include\IE.au3");
$oTemp = $o_object.document.parentWindow
$oTemp = $o_object.document^ ERROR
Error: The requested action with this object has failed.
-----
same as "message 2" in post 1.
----
Line 549 (File "C:\Program Files\AutoIt3\Include\IE.au3");
While Not (String($o_object.readyState) = "complete" Or %o_object.readyState = 4 Or $f_Abort)
While Not (String($o_object.readyState) = "complete" Or %o_object.readyState ^ ERROR
Error: The requested action with this object has failed.

In other words, 3 different error messages with the same AutoIT code (your code).

If I enable "protected mode", all's fine (no error messages and the script runs fine).

Share this post


Link to post
Share on other sites

Posted

That is pretty obviously not what is written to the console.

Share this post


Link to post
Share on other sites

Posted

Why do you say that?

And what "console" are you referring to?

If you want I can post screenshots of the popup windows that actually show these error messages but that won't change anything really. Those are the only messages that AutoIT shows via GUI boxes. Just like in my first post.

As far as the error handler is concerned, I read the AutoIT help file stating that:

"[optional] String variable with the name of a user-defined COM error handler, defaults to the internal COM error handler in this UDF"

However, running your code (exactly as you posted it, but obviously removing the HTML trash this forum has inserted into it) on my machine doesn't show any messages from the "internal COM error handler in the UDF". Instead, it shows popup msgboxes with any one of the 3 messages I posted above.

By the way, just in case you're wondering, I uninstalled a previous AutoIT version before installing the latest.

So I'm pretty sure my IE.au3 is sane.

Share this post


Link to post
Share on other sites

Posted

You're really cheating yourself if you are not running your code from indisde the SciTe editor (F5). It has a console at the bottom that IE.au3 takes full advantage of to display helpful diagnostics.

Dale

Share this post


Link to post
Share on other sites

Posted (edited)

So THAT'S the console you were referring to. OK, will do.

Bear with me please.

I'll try that on Monday from work.

Thanks

Edited by Vieri

Share this post


Link to post
Share on other sites

Posted

As you can see below, I'm not getting more information if I run the code within the editor... Just 3 lines of code.

Am I doing something wrong?

I can send you a screenshot:if you wish.

The code:

#include <IE.au3>
$oIE = _IECreate("http://10.215.144.66/temp/index_login.html")
_IEErrorHandlerRegister()

The console:

>"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "Z:AutoITautologinintranetWin_2K_XPIE6zzz_forum_test2.au3"
C:\Program Files\AutoIt3\Include\IE.au3 (560) : ==> The requested action with this object has failed.:
WEnd
WEnd^ ERROR
>Exit code: 1    Time: 1.426

Share this post


Link to post
Share on other sites

Posted (edited)

Put the call to the error handler BEFORE the line that causes the error...

Dale

Edited by DaleHohm

Share this post


Link to post
Share on other sites

Posted

Here's the console message:

>"C:Program FilesAutoIt3SciTE..autoit3.exe" /ErrorStdOut "Z:AutoITautologinintranetWin_2K_XPIE6zzz_forum_test2.au3"
--> IE.au3 V2.4-0 Error from function _IELoadWait, $_IEStatus_InvalidObjectType
>Exit code: 0    Time: 1.027

and here's the source code:

#include <IE.au3>
_IEErrorHandlerRegister()
$oIE = _IECreate("http://10.215.144.66/temp/index_login.html")

Share this post


Link to post
Share on other sites

Posted

There is something unique about the page that you are connecting to. Is it a standard HTML page? A PDF? ActiveX? JAVA? Is it doing a page redirect to a new URL? Are there AJAX client-side updates occuring after load?

Dale

Share this post


Link to post
Share on other sites

Posted

It's a simple HTML page. Very basic form. No Ajax, nothing. Just need to load the form. In the test source code posted above, I'm not even "post"ing yet.

Here's the HTML source of index_login.html:

<html>
<body>
<table width="100%" border="0" height="90%">
  <tr>
    <td valign="top" width="120" bgcolor="#CCCCCC" height="100%">
	  <div align="right">
	    <form name="form1" id="form1" method="post" action="https://www.hman.local/apps/portal/index.php3">
		  <table border="0" bordercolor="#003399" width="100%" cellspacing="0" cellpadding="0">
		    <tr bgcolor="#003399">
			  <td colspan="2">
			    User
			  </td>
		    </tr>
		    <tr>
			  <td>
				  <br>&#160;User
			  </td>
			  <td>
				  <br><input type="text" name="user" id="user">
			  </td>
	 </tr>
	 <tr>
	   <td>
				  &#160;Password
			  </td>
			  <td>

				  <input type="password" name="password" id="password">

			  </td>			 
		    </tr>
	 <tr>
	   <td align="right" colspan="2">
   <input type="submit" name="btsubmit" value="Enter">
			  </td>
		    </tr>
		 
		  </table>
		  </form>
  
	    </div>
    </td>
  </tr>
</table>
</body>
</html>

Share this post


Link to post
Share on other sites

Posted

It seems to be because in my au3 script I'm calling

http://10.215.144.66/temp/index_login.html
and index_login.html has a "post action" pointing to a hostname
www.hman.local
.

In fact, if I replace www.hman.local with it's IP address, I don't get the error anymore.

But I still don't see why _IECreate should choke on this.

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