atzoref Posted January 25, 2012 Share Posted January 25, 2012 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 Link to comment Share on other sites More sharing options...
water Posted January 25, 2012 Share Posted January 25, 2012 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
ZacUSNYR Posted January 25, 2012 Share Posted January 25, 2012 You're using a variable before you declare it. If you post the code we explain it further. Link to comment Share on other sites More sharing options...
Syed23 Posted January 25, 2012 Share Posted January 25, 2012 (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 January 25, 2012 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
water Posted January 26, 2012 Share Posted January 26, 2012 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
atzoref Posted January 26, 2012 Author Share Posted January 26, 2012 (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 January 26, 2012 by atzoref Link to comment Share on other sites More sharing options...
water Posted January 26, 2012 Share Posted January 26, 2012 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
atzoref Posted January 26, 2012 Author Share Posted January 26, 2012 (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 January 26, 2012 by atzoref Link to comment Share on other sites More sharing options...
Juvigy Posted January 26, 2012 Share Posted January 26, 2012 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now