Sign in to follow this  
Followers 0
mathew

Opt("RunErrorsFatal",0) doesn't work

2 posts in this topic

#1 ·  Posted (edited)

hi,

i have a problem with errors in my script.

i use autoit version v3.1.1.97 (beta).

i create an internetapplication and do some work on websites.

sometimes it happens that an errorwindow pops up saying:

Line 0 (File "D:\Dokumente und Einstellungen\Mathew\Desktop\main.exe"):

While ($o.readyState <> "complete") and ($o.readyState <> 4)
While ($o.readyState ^ ERROR

Error: The requested action with this object has failed.

the error does only apear 1 time in 3 days ( script runs once every hour )

but why does a window pop up when i said that the program should use silent errors?

here is my script

;here were includes for my funtions and vars i use later
;....

AutoItSetOption("MustDeclareVars",1); all vars must be declared
AutoItSetOption("RunErrorsFatal",0)     ; silent error
AutoItSetOption("TrayIconDebug",1); show current script line in the tray icon
AutoItSetOption("PixelCoordMode",0); relative coords to the active window

; open inetexp for login
Global $o_b_login=ObjCreate("InternetExplorer.Application")
If IsObj($o_b_login) Then
 $o_b_login.visible=1
Else
 Fehler("$o_b_login konnte nicht angelegt werden ( Main() )"); logs the error to error.log
 Exit
EndIf

Local $begin=TimerInit()
Do

 Login($o_b_login)

 If TimerDiff($begin)>900000 Then
  Fehler("konnte sich nach 15 min nicht einloggen ( Main() )")
  Exit; exit if the script cant login within 15 mins
 EndIf

Until $o_b_login.document.title == "..."; here stands the windowtitle

; here were the functions i used...
; ...

; close login inetexp
$o_b_login.quit()

for waiting a website to be loaded i use

; -----------------------------------------------------------------------------------
Func LoadingDone ( $o )
; -----------------------------------------------------------------------------------
If IsObj($o) Then

 Local $begin_login=TimerInit()

 While ($o.readyState <> "complete") and ($o.readyState <> 4)
  If TimerDiff($begin_login) > 30000 Then
   $o.stop()
   Sleep(100)
   If $o.LocationURL() <> "" Then
    $o.refresh()
   Else
    Fehler("$o besitzt keine URL ( LoadingDone() )")
    Exit
   EndIf
   Sleep(1000)
   $begin_login=TimerInit()
  Else
   Sleep(250)
  EndIf 
 WEnd
 
 Sleep(500)
 
Else

 Fehler("$o ist kein objekt ( LoadingDone() )")
 Exit

EndIf

EndFunc

can anyone explain me, why the errorwindow pops up ?

Edited by mathew

Share this post


Link to post
Share on other sites



AFAIK, COM errors do not come under RunErrorFatal. This is why people use a COM handlier function for errors. I have seen readystate compared to a integer rather then a string so perhaps the error is the string "complete"?.

Have a look at ObjEvent in the helpfile for error handling. Alot of members use SvenP's error handler which you should be able to search for.

Arh, here is one of Sven's error func examples:

Func MyErrFunc()

  $HexNumber=hex($oMyError.number,8)

  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"     & @CRLF  & @CRLF & _
             "err.description is: " & @TAB & $oMyError.description  & @CRLF & _
             "err.windescription:"   & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "       & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "   & @TAB & $oMyError.scriptline   & @CRLF & _
             "err.source is: "       & @TAB & $oMyError.source       & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile     & @CRLF & _
             "err.helpcontext is: " & @TAB & $oMyError.helpcontext _
            )

  SetError(1) ; to check for after this function returns
Endfunc

HTH

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