Jdop Posted March 5, 2010 Share Posted March 5, 2010 Getting that cryptic array pointer error with a -1 line id (apparently from a library call ) in COMPILED but I never get the error when I run the same code from the editor. Seems odd, and since its fairly long and complex code, hard to debug. Would be nice if the libraries actually passed the reason for crashing. How to deal with this? Link to comment Share on other sites More sharing options...
JohnOne Posted March 5, 2010 Share Posted March 5, 2010 I cannot help you, but others who may be able to will probably be able to do so easier if you give a full error you are getting, and version of autoit, and scite. using latest versions of both, I always get an error with a line number from compiled script. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
trancexx Posted March 5, 2010 Share Posted March 5, 2010 Update your AutoIt first, then ask. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 5, 2010 Share Posted March 5, 2010 The message is not cryptic, you made an invalid array reference. Review the array references in your script. Put in a few _FileWriteLog(), TrayTip(), or ToolTip() debug statements in your script to see how far it got and what it was doing at the time. If the script is too "long and complex" for you, then it's time to climb a little higher on the learning curve. Don't give up, you can figure it out. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
kaotkbliss Posted March 5, 2010 Share Posted March 5, 2010 If I know approximately where my script went wrong, I like to add msgbox for each time a variable is called or changed in that part of the script. That helps me find where the problem is 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Jdop Posted March 7, 2010 Author Share Posted March 7, 2010 I updated to the latest version of Autoit. Lets see if that cures the problem. Whats odd is , is never crashes when run in 'edit mode' only the compiled version. In theory that should not happen. The program loads live data from the internet so its constantly changing and therefore hard to debug if there's a random error. Link to comment Share on other sites More sharing options...
martin Posted March 7, 2010 Share Posted March 7, 2010 (edited) I updated to the latest version of Autoit. Lets see if that cures the problem. Whats odd is , is never crashes when run in 'edit mode' only the compiled version. In theory that should not happen. The program loads live data from the internet so its constantly changing and therefore hard to debug if there's a random error. You can possibly find the line number if you compile the script as converted by the code below. NB This was only written for 1D arrays and so would need changing for more dimensions, but the basic idea is there. #include <file.au3> $PresentScriptname = "tproblemscript.au3";<------------put your file name here $DebugScriptName = "debugfile.au3";<--------put the name of the copy here $ArrayName = "$brray";<-----------put your array variable name here $Newf = FileOpen($DebugScriptName, 2) Global $text _FileReadToArray($PresentScriptname, $text) For $n = 1 To $text[0] If StringLeft(StringStripWS($text[$n], 1), 3) <> "Dim" Then $sl = StringRegExp($text[$n], "\" & $ArrayName & "\[.*?\]",3) if isarray($sl) then for $k = 0 to ubound($sl) - 1 FileWriteLine($Newf,StringRegExpReplace($sl[$k], ".*(\" & $ArrayName & "\[)(.*)?(\])", "CheckArray(\" & $ArrayName & ",\2," & $n & ")",1) ) Next EndIf EndIf FileWriteLine($Newf,$text[$n]) Next FileWriteLine($Newf, @CRLF & "Func CheckArray($aA,$iS, $iLn)") FileWriteLine($Newf, @TAB & "if UBound($aA) < $iS + 1 then ") FileWriteLine($Newf, @TAB & @TAB & 'MsgBox(262144,"ERROR on line" & $iLN, "Array has " & UBound($aA) & " elements," & @CRLF & "but " & $iS & " called for")') FileWriteLine($Newf, @TAB & @TAB & 'exit') FileWriteLine($Newf, @TAB & 'Else') FileWriteLine($Newf, @TAB & @TAB & 'Return $aA[$iS]') FileWriteLine($Newf, @TAB & 'EndIf') FileWriteLine($Newf, 'EndFunc') FileClose($Newf) Note that the line number reported with the error is the line number in the original script not the debug script. I have only tried it on a simple example so it probably needs some improvements. EDIT: Changed to allow for the Array variable appearing more than once on a line. But really you should write your script so that the error doesn't occur, but since you haven't shown any code we can only guess. Edited March 7, 2010 by martin 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...
Jdop Posted March 8, 2010 Author Share Posted March 8, 2010 I'm getting the same error, only now it reports Error at line 13333. Obviously this is not much more helpful than line -1 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 8, 2010 Moderators Share Posted March 8, 2010 Jdop,Obviously this is not much more helpful than line -1Why not? It tells you exactly where the error is, which is why trancexx told you to upgrade your Autoit version. Now your problem is to work out which line of code 13333 actually is - as the compiler strips out all comments and blanks. Did you run the code through Obfuscator when compiling? If you had, you would find a file "filename_Obfuscated.au3" in the same folder as your script which is what the compiler actually used to produce the final script. If you had used the /StripOnly parameter with Obfuscator you would have automatically stripped all the comment and blank lines, so the line given in the error message would refer directly to that line in the Obfuscated file. And then you would know where the problem lies! If want to try this, you need the full SciTE4AutoIt3 package, which you can download from here. You get lots of other goodies as well, so it is well worth it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
martin Posted March 8, 2010 Share Posted March 8, 2010 (edited) Jdop,Why not? It tells you exactly where the error is, which is why trancexx told you to upgrade your Autoit version. Now your problem is to work out which line of code 13333 actually is - as the compiler strips out all comments and blanks. Did you run the code through Obfuscator when compiling? If you had, you would find a file "filename_Obfuscated.au3" in the same folder as your script which is what the compiler actually used to produce the final script. If you had used the /StripOnly parameter with Obfuscator you would have automatically stripped all the comment and blank lines, so the line given in the error message would refer directly to that line in the Obfuscated file. And then you would know where the problem lies! If want to try this, you need the full SciTE4AutoIt3 package, which you can download from here. You get lots of other goodies as well, so it is well worth it. M23The code I provided gives the line in the original script. So line 1333 is just that. It also tells you the index and the array UBound. You can eassily extend the code I gave to tell you more, for example the values of other variables.EDIT: I suppose I have to assume the OP has not actually tried my code. Edited March 8, 2010 by martin 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...
Jdop Posted March 10, 2010 Author Share Posted March 10, 2010 I'm getting pointers to line numbers that are not array related, even though the error message says "array error". Is there some 'wiggle room' in the line number thats reported in the obfuscated code. Link to comment Share on other sites More sharing options...
trancexx Posted March 10, 2010 Share Posted March 10, 2010 Are you using /striponly only? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Jdop Posted March 11, 2010 Author Share Posted March 11, 2010 Yes, I am. I've gotten some line pointers that make sense, and some that don't. I'm working on it. Link to comment Share on other sites More sharing options...
MariusN Posted March 12, 2010 Share Posted March 12, 2010 I usually get that error when i forget to declare my variable... Link to comment Share on other sites More sharing options...
Jdop Posted March 13, 2010 Author Share Posted March 13, 2010 (edited) I usually get that error when i forget to declare my variable... Are you saying you get a bogus error or line number when you use an undeclared var? The var on the error I am getting was undeclared, so I added it to the DIM's. Let's see if that cures it. Wondering if that 'declaration' issue would cause a difference in compiled vs. editor operation, as I never seem to get that error running off Scite. Edited March 13, 2010 by Jdop Link to comment Share on other sites More sharing options...
MvGulik Posted March 19, 2010 Share Posted March 19, 2010 (edited) whatever Edited February 7, 2011 by MvGulik "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... 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