Jump to content
Pablos544

Variable used without being declared

Recommended Posts

Pablos544

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
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
232showtime

 

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
Pablos544
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
water

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

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Pablos544
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
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Pablos544
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
water

I will do my very best ;)

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
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

×