Jump to content

Variable used without being declared


Recommended Posts

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.

Link to comment
Share on other sites

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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I will do my very best ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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