Jump to content

Is there an easy way to debug "subscript used on non-accessible variable" errors in compiled scripts?


Recommended Posts

Some of my end users might occasionally get the dreaded "subscript used on non-accessible variable" message with a line number that's only relevant to the compiled version. Usually debugging this is therefore a nightmare for me.

Is there an easier solution to debug this issue? Obviously it's things that SciTE's Syntax Check doesn't catch. 

Link to comment
Share on other sites

SciTE can't catch runtime errors. It looks like you are accessing an array with an index out of bound. Without seeing any code from you I would say to check your arrays bounds before accessing them by indices to be sure you are in the limits.

When the words fail... music speaks.

Link to comment
Share on other sites

5 minutes ago, Andreik said:

SciTE can't catch runtime errors. It looks like you are accessing an array with an index out of bound. Without seeing any code from you I would say to check your arrays bounds before accessing them by indices to be sure you are in the limits.

Yeah, that's what's happening. But at 13,000 lines, and lots of Redim, it can get tricky. Oh well. I figured there might be something easier.

Link to comment
Share on other sites

  • Developers

One can get the line that the error is about by running au3stripper with the mergeonly option. 

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

If this happens only occasionally, here how I debug it.  You will need to create a log of all the functions that use arrays.  Once you know which functions are involved, add all details of array usage in the log.  You should be able to discover every single array implied in a bug.

Link to comment
Share on other sites

2 minutes ago, Nine said:

If this happens only occasionally, here how I debug it.  You will need to create a log of all the functions that use arrays.  Once you know which functions are involved, add all details of array usage in the log.  You should be able to discover every single array implied in a bug.

That's good advice! Thanks.

Link to comment
Share on other sites

16 minutes ago, Jos said:

One can get the line that the error is about by running au3stripper with the mergeonly option. 

Forgive my ignorance, but how do I run au3stripper. I tried in the past, but the docs point to a directory inside SciTE that doesn't exist. I also tried adding #Au3Stripper_Parameters=/MergeOnly to the top of my Au3 and compiled it but that didn't seem to do anything either. I truly have looked into it but gave up after about an hour and haven't tried again until now.

Edit: Nevermind. It seems that your bio link has a link to the portable version which has au3stripper. For waterer reason the SciTE that comes with AutoIt install lacks it.

Edited by lowbattery
Link to comment
Share on other sites

  • Developers

First install the separate scite4autoit3 installer which comes with these extra utilities. 

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

On 8/24/2023 at 1:44 PM, lowbattery said:

my end users might occasionally get the dreaded "subscript used on non-accessible variable" message

use something to look professional while you learn to code :D  

Edited by argumentum
oops. posted the wrong link =/

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

  • 4 months later...

@Jos I'm currently facing a similar Situation.

I've ran Au3Stripper the only thing it does is removing my comments and empty lines... I don't see the rest of the code.. So my code goes from 700 to 500 lines ... But I need 9390 am I missing something? 

Link to comment
Share on other sites

  • Developers
1 hour ago, Sly01 said:

am I missing something? 

Yes...  the /MO or /MergOnly option is missing when you get that:

#Au3Stripper_Parameters=/mergeonly

 

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

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...