Jump to content

Recommended Posts

Posted

Hi,

I can't understand why these warnings shows up.

What can be the possible reasons?

Becuse it seems to be Ok , they are actuall declare.

(Also I uses some other scripts, when the main script contains them with includes)

Thanks

Posted

Please post the code and the error messages you get (line number, name of variable in error is needed).

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted (edited)

ok .. add the below line to your code next to Header files. And when you run the code that will tell you what are all the variables need to be declared before compile or executing..

[autoit]

Opt("MustDeclareVars",1)

[/autoit]

Hope this helps you!

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Posted

Hi Syed,

it's exactly the other way round. Somewhere in his code there is already this Opt statement or a wrapper directive and somewhere he has an undeclared variable.

But without code and the full error message it's hard to say where the problem is.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted (edited)

It's a little bit hard to post the code here because I'm using some other scripts with the main script. Download Link for the program: http://www.mediafire.com/?xajej65p06q22bw (The main script is: AMT_Main_tmp.au3 I give you a little explantion For Example: In the main script I write:

#include "SomeOtherScript.au3"
Global Const $TEMP = 2
Then I'm running here a function which exist in "SomeOtherScript.au3" which uses this Global Const var Thats All.

Edited by atzoref
Posted

The Constant is defined after the #include, right?

As AutoIt is interpreted top down the Constant is unknown to AutoIt when the Syntax check is beeing done. Example:

Func test()
    ConsoleWrite($Global & @CRLF)
EndFunc
Global Const $Global = 2
Test()

Move the Const to the top of the file and everyhting will be fine:

Global Const $Global = 2
Func test()
    ConsoleWrite($Global & @CRLF)
EndFunc
Test()

But I would recommend to define all variables and constants you need in the include-file itself.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted (edited)

yes it help,

I raise them aboce the includes so it works now.

I put them in the main script because they are used by some scripts (not only by one)

Edited by atzoref
Posted

Good practice:

Create/Declare all global constants in a file and include it in the begining of the main script.

@PS Very usefull for large scripts with a lot of constants and global variables.

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
×
×
  • Create New...