Pablos544

Variable used without being declared

9 posts in this topic

#1 ·  Posted

Hi All,

I keep getting 'variable used without being declared' when I run my script.Problem is the line number is wrong, it says like Line 3792 which is the line number after the #include files have been put in.  

It's not very helpful because there is no mention of which variable it is, and I have no idea where on the script it is.

Anything I can do?  Short of going through each variable line by line making sure it is declared??

The AutoIt3 Script in question is a compiled EXE.  I'm not sure if running it first as a non-EXE would give me more additional useful information which would be ideal but the script can only be tested as an EXE.

Thanks, All.

Pablo.

Share this post


Link to post
Share on other sites



#2 ·  Posted

Running your script in SciTE will definitely give you a more detailed error information. E.g.:

Quote

"C:\temp\Test.au3"(17,21) : warning: $pid: possibly used before declaration.
            ProcessClose($pid)
            ~~~~~~~~~~~~~~~~~^

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

 

autoit  tells you where the error is ,

31 minutes ago, Pablos544 said:

Line 3792

that's where the error is, check the left side of autoit editor.

it is much better if you will show your script. :lol:


ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#4 ·  Posted

1 hour ago, water said:

Running your script in SciTE will definitely give you a more detailed error information. E.g.:

 

Sup water , 232showtime,

Yes I kind of guessed that running the script in SciTE will show much better errors like that 'Variable ...being declared.'  Problem I'm having is this script has to check  cmdLine[1]  for an input file which actually thinking about it I suppose I could 'fake' couldn't I?? Then I could see what it does in a safe environment.

I think the Line 3792 is the 'expanded' line after the #included.... lines have been put in.

I think it is also possible to calculate the actual line by adding how many lines each #include ... file is.

Cheers, guys! You've been very helpful!! :)

Pablo.

Share this post


Link to post
Share on other sites

#5 ·  Posted

Yes, you can fake the command line in SciTE. Try Shift-F8.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

48 minutes ago, water said:

Yes, you can fake the command line in SciTE. Try Shift-F8.

 

Awsome water thank you so much!  The faking attitude has done the job spot on.

Now I'm getting awesome error messages: "Line 11 (File .....) $sThisThat ^ ERROR  Error: Variable used without being declared"

whoa!!! 

Thanks!! :D

Pablo.

Share this post


Link to post
Share on other sites

#7 ·  Posted

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#8 ·  Posted

1 hour ago, water said:

:)

Sorry I couldn't resist :) I see you're doing some nice work water keep up the good work it's much appreciated! take care buddy

Share this post


Link to post
Share on other sites

#9 ·  Posted

I will do my very best ;)

1 person likes this

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


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