packrat Posted April 24, 2009 Share Posted April 24, 2009 I have a 4200-line AutoIt script (3000 operational lines in 72 functions, the remainder comments and whitespace) that I converted from a VBA-like language. I've run into a problem where the AutoIt script just exits the script at a certain point for no seeming reason at all. I've narrowed the exit point at about line 3200 (of the 4200), where a 4-line loop (just 2 lines of active code) occurs. I've put MsgBox's just before and just after this loop: during script operation, the first MsgBox displays but the second does not because AutoIt exited. (Just in case it's helpful, I should also mention that, on one occasion, rather than immediately exiting, AutoIt spuriously jumped to another function and then exited from somewhere in that function.) In addition, when I commented out the 4-line While/WEnd loop and inserted another loop (For/Next), AutoIt similarly exited when it reached that loop. The only programming reasons I can think of (based on experiences with other programming languages, especially Microsoft's) are the following: (1) the script is too long or has too many functions; (2) this (or another or all) function is too long [this one is only 126 lines, including Func/EndFunc] [functions being too long is a common "hidden" Microsoft gotcha]; (3) the While/Wend loop exceeds the maximum allowable depth of loops, If's, Select's, functions calling functions, etc. [nesting depth is the most common Microsoft gotcha that I've run into]; or (4) the maximum variable space was exceeded. Anyone know what AutoIt's limits are for these aspects? And, if there are no relatively low limits, does anyone have any other ideas of why AutoIt might just arbitrarily exit a script? Especially at a loop? This is quite puzzling to me (I can't find any mention of such an arbitrary exit in the documentation), and, because I don't know what's causing it, I haven't the slightest idea of how to work around it (if that's even possible). Thanks in advance for any help or ideas! Harvey Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 24, 2009 Moderators Share Posted April 24, 2009 packrat, Some code would be a great help! 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...
Developers Jos Posted April 24, 2009 Developers Share Posted April 24, 2009 Doubt its any of your shown possibilities.What is the returncode autoit3 exits with? Are you running a compiled version or from SciTE? Are you using any DLLCall's ? 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 comment Share on other sites More sharing options...
packrat Posted April 24, 2009 Author Share Posted April 24, 2009 Doubt its any of your shown possibilities.What is the returncode autoit3 exits with?None. But your question led to me learning more about AutoIt: I didn't realize there were such things as exit return codes.Are you running a compiled version or from SciTE?I was running from SciTE. I tried compiling the code, and that's when the real error showed up (see below). I didn't realize that running from SciTE and running compiled behave differently, at least in terms of error notification.Are you using any DLLCall's ?No.As I mentioned above, running the compiled version of the code turned up the real culprit (and, as you noted, it wasn't any of the four possibilities I had suggested):"Array variable has incorrect number of subscripts or subscript dimension range exceeded."I neglected to remember that the original code had 1-based arrays and that AutoIt has 0-based arrays. Once I made that change, everything worked fine. Curiosity question: how come running under SciTE didn't alert me to such a basic error? (I normally run interactively under SciTE to find and fix errors and then, when everything works correctly, I compile my scripts.)Thanks for your guidance in leading me to find the source of my problem!Harvey 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