Jump to content

IE.au3 WEnd ERROR


Vieri
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

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

  • 2 weeks later...

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

Link to comment
Share on other sites

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

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

#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

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

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.

Link to comment
Share on other sites

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

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

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

Link to comment
Share on other sites

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

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

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.

Link to comment
Share on other sites

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

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

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
Link to comment
Share on other sites

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

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

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")
Link to comment
Share on other sites

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

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

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>
Link to comment
Share on other sites

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.

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