Jump to content

Recommended Posts

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)





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

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

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


Link to post
Share on other sites
  • Developers

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.


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
Live for the present,
Dream of the future,
Learn from the past.

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.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...