dotnetfreak Posted June 2, 2009 Share Posted June 2, 2009 Hi everyone. Im using autoit 3.3.0.0 I would like to know if line numbers can be displayed when an error occurs on a compiled script.. Im running the script at the end of this post, but the line number is always -1 . Am I doing somethign wrong? thanks in advance Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;---------------------------------------------------------------------------------------------------------- ; Com Error Handler ;---------------------------------------------------------------------------------------------------------- Func MyErrFunc() 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 $test = 0 MsgBox(0,"test","test",$test[0]) Link to comment Share on other sites More sharing options...
jpres Posted June 2, 2009 Share Posted June 2, 2009 Hi everyone. Im using autoit 3.3.0.0 I would like to know if line numbers can be displayed when an error occurs on a compiled script.. Im running the script at the end of this post, but the line number is always -1 . Am I doing somethign wrong? thanks in advance Global $oMyError = ObjEvent("AutoIt.Error","MyErrFunc") ;---------------------------------------------------------------------------------------------------------- ; Com Error Handler ;---------------------------------------------------------------------------------------------------------- Func MyErrFunc() 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 $test = 0 MsgBox(0,"test","test",$test[0]) you have a MsgBox to display $test[0], but $test[0] was never set to my knowledge? Link to comment Share on other sites More sharing options...
Valik Posted June 2, 2009 Share Posted June 2, 2009 There are no line numbers for compiled scripts. Link to comment Share on other sites More sharing options...
dotnetfreak Posted June 2, 2009 Author Share Posted June 2, 2009 you have a MsgBox to display $test[0], but $test[0] was never set to my knowledge? Yes, that was on purpose so the scripts throws an error... but that is not my problem, the problem is that when I run that script compiled I dont get the line number where the error is generated Link to comment Share on other sites More sharing options...
herewasplato Posted June 2, 2009 Share Posted June 2, 2009 Yes, that was on purpose so the scripts throws an error... but that is not my problem, the problem is that when I run that script compiled I dont get the line number where the error is generatedSo add a func to help you debug. Use "half splitting" with this line _dbgTIP(6) Global $line Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") _dbgTIP(6) MsgBox(0, "test", "test", $test[0]) Func MyErrFunc() ;nothing EndFunc ;==>MyErrFunc Func _dbgTIP($line) TrayTip("", $line, 100) Sleep(10000) EndFunc ;==>_dbgTIP [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
James Posted June 2, 2009 Share Posted June 2, 2009 Expanding from Valiks reply. Once a script is compiled, all lines are joined together, this is why compiled scripts will give a -1 line error. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Valik Posted June 2, 2009 Share Posted June 2, 2009 ...the problem is that when I run that script compiled I dont get the line number where the error is generatedNo, the problem is, you shouldn't be running a compiled version of a script until you've thoroughly tested it by running it non-compiled. Link to comment Share on other sites More sharing options...
herewasplato Posted June 2, 2009 Share Posted June 2, 2009 No, the problem is, you shouldn't be running a compiled version of a script until you've thoroughly tested it by running it non-compiled.$var = "C:\temp\devicetable.log" FileInstall("C:\devicetable.log", $var)Are there other AutoIt functions that only "work" in non-compiled scripts when used with the improper syntax? @OP, Are you using FileInstall somewhere in your code? [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
martin Posted June 2, 2009 Share Posted June 2, 2009 $var = "C:\temp\devicetable.log" FileInstall("C:\devicetable.log", $var)Are there other AutoIt functions that only "work" in non-compiled scripts when used with the improper syntax?Is there something wrong with the syntax in your example? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
herewasplato Posted June 2, 2009 Share Posted June 2, 2009 Is there something wrong with the syntax in your example?$var = "C:\devicetable.log" FileInstall($var, "C:\temp\devicetable.log")No, there wasn't. ty Hopefully folks won't miss the point of my post. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Valik Posted June 2, 2009 Share Posted June 2, 2009 Other than FileInstall(), I don't know of anything. But the syntax of FileInstall() is all messed up anyway. It shouldn't be a run-time function. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now