Jump to content

IE page refresh kills script


Recommended Posts

My script is monitoring a page and changing some text on screen, script works fine until the page is refreshed...then it kills the script with error:

C:\Program Files (x86)\AutoIt3\Include\IE.au3 (3013) : ==> The requested action with this object has failed.:

$oTemp.innerText = $newvalue

$oTemp.innerText = $newvalue^ ERROR

Is there a way to keep the script running regardless of if there is a momentary lapse in form read?

#include <IE.au3>
 
$oIE=_IECreate("...\Test.html")
$varForm=_IEFormGetObjByName($oIE,"form1")
 
While 1
$varText=_IEGetObjById($oIE,"line1")
$varTextGet=_IEPropertyGet($varText, "innertext")
Sleep(1000)
_IEPropertySet($varText,"innertext","This is the result of the script changing the text")
WEnd

Attached is the test.html file i am trying this on.

Test.html

Link to comment
Share on other sites

Global $oErrorHandler = ObjEvent("AutoIt.Error", "ObjErrorHandler")
;your code

Func ObjErrorHandler()
    ConsoleWrite("A COM Error has occured!" & @CRLF & @CRLF & _
            "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _
            "err.windescription:" & @TAB & $oErrorHandler & @CRLF & _
            "err.number is: " & @TAB & Hex($oErrorHandler.number, 8) & @CRLF & _
            "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _
            "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _
            "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _
            "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _
            "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext & @CRLF _
            )
EndFunc   ;==>ObjErrorHandler

Br,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

That works UEZ, thanks.

Question is why does this work, this is new to me...sorry for a n00b question. I guess the original way that i had it written, when the error occurred, autoit didnt know how to handle the error so it fails. The ObjEvent() captures those events and does what ever the function specifies based on the error type? Am i understanding this correctly?

Thanks for your help

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