Hasher

Annoying Error

8 posts in this topic

Ok so I have autoit app which runs in a compiled state . About every 10th time it runs it throws up an error "Line 5129 : Error in Expression" . Problem is I can't recreate the error un-compiled . I have a error function but it doesn't seem to catch the error. Any suggestions for hunting down this error?

My Error check :

Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc")


Func MyErrFunc($oMyError)

Local $HexNumber

Local $strMsg

$HexNumber = Hex($oMyError.Number, 8)

$strMsg = "Error Number: " & $HexNumber & @CRLF

$strMsg &= "WinDescription: " & $oMyError.WinDescription & @CRLF

$strMsg &= "Script Line: " & $oMyError.ScriptLine & @CRLF

MsgBox(0, "ERROR", $strMsg)

SetError(1)

Endfunc

 

Untitled.jpg


Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites



I have no idea where the error could be because I have no idea what your code looks like.

Share this post


Link to post
Share on other sites

It's over 800 lines of code , I am trying to narrow it down


Firefox's secret is the same as Jessica Simpson's: its effortless, glamorous style is the result of — shhh — extensions!

Share this post


Link to post
Share on other sites

Yes have a look on this small script:

#include <Array.au3>

local $sFile1 = @scriptdir & '\file2.txt'

Local $aResult=StringSplit(StringStripWS(StringReplace(StringReplace(StringReplace(FileRead('file2.txt'),@CRLF,' '),@TAB,' '),',',' '),7),' ',3)
For $i=0 To UBound($aResult)
    ConsoleWrite($i&': '$aResult[$i])
Next
_ArrayDisplay($aResult)

the error is in line 7. But there is one include, so linenumber in exe not 7. Using au3stripper with param /mo i get this file: test_stripped.au3  The exe throw's error:

90_AutoIt Error.jpg

 

Yet, having a look in the stripped au3 file what's in line will get result:

ConsoleWrite($i&': '&$aResult[$i])

 

1 person likes this

Share this post


Link to post
Share on other sites

yes, but only when you have the full version of SciTE4AutoIt3 installed!
You can then have a look at the Scriptfilename_stripped.au3 generated file for the correct line.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Am I missing something or is it just an array subscript out of range thing? Change:

For $i=0 To UBound($aResult)

... to:

For $i=0 To UBound($aResult)-1

... because let's say $ar holds three elements, then UBound($ar) will be 3, but you have elements [0], [1] and [2], but NOT [3]. Your loop loops from zero to three (0 to UBound($ar)) so when it gets to three, it will break.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

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