Jump to content

AutoIt just arbitrarily exits a script!


Recommended Posts

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

  • Moderators

packrat,

Some code would be a great help!

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Developers

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

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...