Jump to content

Variable not declared error with Opt("MustDeclareVars", 1) set

Recommended Posts

A script I've written runs every single time I personally run it, whether as an exe or in Scite.  However, sometimes when I go to check on it (it runs periodically from a scheduled task) I'll come across it with an error saying that there was an error: variable used without being declared.  Except, I have Opt("MustDeclareVars", 1) set, and so thus, every variable has to be declared, right?  So how does this come up?  I've never managed to get this error to come up when I run it in Scite, so I'm at a loss as to how to hunt down what's causing it.  Suggestions or advice for me anyone?

Link to post
Share on other sites
On 7/22/2018 at 10:33 PM, AutoBert said:

Did you declare one or more variables in If ... then statement's or only for special cases and ignored warning's from au3 check?

Just insert

#AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6

in your script and don't ignore them further.

This is indeed what happened.  I had a 'local' declared in an if, but not in the 'else' for it.  Using all these parameters allowed me to find the issue.  Thank you.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...