Jump to content

IE.au3 playing up again


Recommended Posts

C:\Program Files\AutoIt3\beta\Include\IE.au3 (3874) : ==> Variable must be of type "Object".:

$IEComErrorScriptline = $oIEErrorHandler.scriptline

$IEComErrorScriptline = $oIEErrorHandler^ ERROR

It is doing this even though it crashes when I am not using any IE functions.....

Func qwert()
    
    Select
        
    Case $commands[2] = "TAW" and $commands[3] = "Targetfinder" and $commands[0] = 3
        taw()
    msgbox(0, "title", "flag 1")
    case Else
        error()
        
EndSelect

Taw() is a function for IE automation... But it gets through all of it perfectly. Then the flag1 message box is fired so I know it is not TAW(). Then the script should go back into this loop at the start of the code:

while 1
sleep(500)
wend

But for some reason the script crashes with that error. Anyone know why it would be doing this?

EndFunc

Link to comment
Share on other sites

@brodie28

It seems to me that the "other" time IE.au3 was "playing up" for you it was caused by errant/zombie IEXPLORE.EXE processes running on your system and it was fixed by logging out and back in or rebooting. It hardly seems fair to make such a general disparaging remark -- unless I don't understand what "playing up again" means.

I'm puzzled why you would get such an error and I would need your help creating a reproducer to troubleshoot it. The code you supply is insufficient. You may also want to add trace lines to your script to be able to see what was last executed.

If "Func taw()" is using IE.au3 then minimally that is where we need to look for issues. The error line returned is in the COM error handler and it is telling us that somehow $oIEErrorHandler is not an object at the time the error is trapped. Are you using _IEErrorHandlerRegister? Are you calling ObjEvent("AutoIt.Error"... anywhere? Can you reproduce this?

Also, since you had this trouble before, please exit all IE windows and insure there are no IEXPLORE.EXE processes still running or logout/reboot and insure that you can still reproduce the problem.

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

The topic title was not meant as a disparraging remark. IE.au3 is in fact my favourite and most used UDF, however I have had some recent troubles with it and so in my frustration I named the topic like I did.

I have rebooted and such several times, and get the exact same error. I am not using _IEErrorHandlerRegister at all in my script.

I am sure that all the code in TAW() is fine, as I can run it as it's own script without any such difficulties and the message box firing when it is complete lets me know that it does get through the function.

The only thing I can think of is that the MSN UDF I am also using from the scrips and scraps forum which also uses OBJ and COM functions is causing this problem. The strange thing about it though is that the script does not crash until after I call TAW(). Here is some more complete code...

#include <MSN.au3>
#include <File.au3>
#include <Array.au3>
#include <IE.au3>

global $info[50][4]




$cdopen = False
global $commands 
$msn = _msncreate()
global $files

while 1
sleep(500)
wend

Func _msn_OnTextReceived($IMSession, $IMUser, $MsgHeader, $MsgText, $Something)
If StringLeft ( $MsgText, 3 ) = "cmd" Then
$comm = StringTrimLeft($MsgText, 4)
$command = StringStripWS ( $comm, 6 )


$commands = StringSplit ( $command, " ", 1)

if $commands[0] > 1 Then

Select

case $commands[1] = "msn"
    Msn()
Case $commands[1] = "list"
    list()
Case $commands[1] = "misc" 
    misc()
Case $commands[1] = "network"
    network()
case $commands[1] = "file"
    file()
Case $commands[1] = "process"
    process()
Case $commands[1] = "random"
    qwert()
case Else
    error()
EndSelect
else 
    error()
    
EndIf

    endIf



EndFunc

Func qwert()
    
    Select
        
    Case $commands[2] = "TAW" and $commands[3] = "Targetfinder" and $commands[0] = 3
        taw()
    
    case Else
        error()
        
EndSelect

EndFunc

Func TAW()

$o_IE = _IECreate ("www.theancientwars.com", 0, 1, 1)
_IELoadWait ($o_IE)


$o_Form = _IEFormGetCollection($o_IE, 0)
$o_username = _IEFormElementGetObjByName($o_form, "uname")
$o_email = _IEFormElementGetObjByName($o_form, "uemail")
$o_password = _IEFormElementGetObjByName($o_form, "psword")
$o_SButton = _IEFormElementGetObjByName($o_Form, "submit")




_IEFormElementSetValue($o_username, "xxx")
_IEFormElementSetValue($o_email, "xxx")
_IEFormElementSetValue($o_password, "xxx")

$o_SButton.click


_IELoadWait ($o_IE)

$tap = 1
$as = 1
$index = 0
$found = 0

For $page = 1 to 10

    _IENavigate ($o_IE, "http://www.theancientwars.com/battlefield.php?page=" & $page)

_IELoadWait ($o_IE)

$string = _IEBodyReadHTML ( $o_IE )

$source = FileOpen ( "testin.txt", 2 )

FileWrite ( $source, $string )

FileClose ( $source )

$lcount = _FileCountLines( "testin.txt" )

$sourc = FileOpen ( "testin.txt", 0 )



$found = 0





For $number = 1 to $lcount



$unpnair = FileReadLine ( $sourc, $number)


If StringInStr ( $unpnair, "Nairagua </FONT>") <> 0 then


$unair = StringTrimleft ( $unpnair, 22 )

$nag1 = StringTrimright ( $unair, 27 )


If StringInStr ( $nag1, "??") = 0 Then
    
    $index = $index + 1
    
    $nair = StringReplace ( $nag1, ",", "")
    $upname = FileReadLine ( $source, $number - 4)
    $temp = StringSplit ( $upname, ">")
$uname = $temp[4]

    $name = StringTrimright ( $uname, 4 )

$upid = StringTrimLeft ( $upname, 53 )
$uid = StringSplit ( $upid, """")
$id = $uid[1]


If $index >= 49 Then

    $ran = $info[1][0]
    
    
    For $numb = 0 to 49
    If number($info[$numb][0]) < number($ran) Then
    $ran = $info[$numb][0]
    $tel = $numb
    
EndIf


Next
    FileClose ( $sourc )

If number($nair) > number($ran) Then
    $info[$tel][0] = number($nair)
$info[$tel][1] = $name
$info[$tel][2] = "Defence"
$info[$tel][3] = $id

EndIf
Else


$info[$index][0] = number($nair)
$info[$index][1] = $name
$info[$index][2] = "Defence"
$info[$index][3] = $id

EndIf
EndIf
EndIf
Next
Next



_ArraySort($info,1,0,0,4,0)



For $tr = 0 to 49

$win = _msnopenchatwindow($msn, "Brodie28@hotmail.com")

_msnsendtext($win, $info[$tr][1] & "     " & $info[$tr][0] & @CRLF & "http://www.theancientwars.com/stats.php?id=" & $info[$tr][3])

next

_IEQuit ( $o_IE )


EndFunc

It is important to remember that the TAW() function executes perfectly.

Link to comment
Share on other sites

In SciTe, please use Tools, Trace: Add Trace Lines

Then run the script and use the console output to track exactly the last line of your code before the error occurs.

Thanks,

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

The last line of code executed is EndFunc for the Function qwert().

For some reason it never gets past that.

Unfortunately this isn't making any sense.

You are going to need to do more work to narrow down where the problem is coming from and to create a small reproducer.

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

Well you've got ~100 lines of code -- try to cut it down to ~10.

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 think it has something to do with this

$win = _msnopenchatwindow($msn, "Brodie28@hotmail.com")

_msnsendtext($win, $info[$tr][1] & "     " & $info[$tr][0] & @CRLF & "http://www.theancientwars.com/stats.php?id=" & $info[$tr][3])

These commands come from the MSN UDF which uses object functions. Here are the definitions for those functions.

func _msnopenchatwindow($object, $email)
if not IsObj($object[2]) then return 0
$object = $object[2]
$win = $object.LaunchIMUI($email)
return $win
endfunc



func _msnsendtext($win, $msg)
if not IsObj($win) then return 0
$win.SendText($msg)
return 1
endfunc
Link to comment
Share on other sites

OK, you now have a theory... now work on proving it - or not. Start culling down the code to the smallest snippet possible that demonstrates the trouble. Nothing you have provided so for has given any clues... this is why I am insisting that the ball is in your court. There is no substitute to doing the required troubleshooting steps to distill this down.

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 worked out that it was _IECreate in the TAW() function which is causing this error. Here is the least amount of code that will trigger it.

#include <MSN.au3>
#include <IE.au3>


$msn = _msncreate()

while 1 
    sleep(500)
WEnd




Func _msn_OnTextReceived($IMSession, $IMUser, $MsgHeader, $MsgText, $Something)

test()

EndFunc



func test()
    
    $o_IE = _IECreate ("www.theancientwars.com")
EndFunc

It has something to do with the MSN UDF and IECreate.

Any ideas on how I can fix this?

Link to comment
Share on other sites

Good job cutting this down.

When you run this, what happens? Please give me detailed steps and results.

When I run it, nothing happens. The $msn array returns two valid objects, but I get no window and nothing to the console. Note however that I am running "Windows Live Messenger" on this system...

Also, I don't think you've ever specified the version of AutoIt you are running. Also send the console output from _IE_VersionInfo()

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 am using the beta version v3.1.1.133 to run this script.

What I forgot to mention is that the test() function is only fired when you receive a message on windows messenger. So this script should start up and be stuck in the while loop until you get sent a message, which I think is what you are experiencing.

When someone sends me a message the function works perfectly, and the IE window opens. The function finishes - but then it crashes. The last line of code that it executes is end func for the test() function. I get this error in the console.

C:\Program Files\AutoIt3\beta\Include\IE.au3 (3874) : ==> Variable must be of type "Object".:

$IEComErrorScriptline = $oIEErrorHandler.scriptline

$IEComErrorScriptline = $oIEErrorHandler^ ERROR

+>AutoIT3.exe ended.rc:0

And as I have discovered, this only happens when there is an IECreate in the code somewehre. I tried it with IEattatch and it works fine.

EDIT: This is the output from IE version info.

--> IE.au3 Information from function _IE_VersionInfo, version T2.0-5 (Release date: 20060703)

Also, I replaced the function that fires when you receive messages on windows messenger with one that fires on a hotkey, and did not get the error. So it must be a combination of that function and IE create causing this.

Edited by brodie28
Link to comment
Share on other sites

Any ideas on what is doing it?

I still cannot reproduce the problem. But it doesn't fire the event routine OnTextReceived for me either.

Perhaps someone who uses the MSN.au3 UDF could test to see if they can reproduce the issue?

Here is the code I used:

#include <MSN.au3>
#include <IE.au3>
$msn = _msncreate()
;_msnlogin($msn)
ConsoleWrite("Object Status: " & _
            IsObj($msn[1]) & "/" & ObjName($msn[1]) & ", " & _
            IsObj($msn[2]) & "/" & ObjName($msn[1]) & @CR)
while 1 
    sleep(2000)
WEnd
Func _msn_OnTextReceived($IMSession, $IMUser, $MsgHeader, $MsgText, $Something)
    ConsoleWrite("In _msn_OnTextReceived()" & @CR)
    test()
EndFunc
func test()
    ConsoleWrite("In Test()" & @CR)
    $o_IE = _IECreate ("www.theancientwars.com")
EndFunc

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've tried both ways.

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

Seeing as you cannot reproduce this error (assuming it is because you are using windows live messenger and not windows messenger) is there anything else I can do to make my script not crash at the end of the function?

Could I get rid of the internal error trapping function in IE.au3 or something?

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