coolooc Posted November 28, 2012 Share Posted November 28, 2012 Hi, I'm using functions from one file in two different files, so i include this file in both of them. I run the functions in those files from another file, so i include both of them in that file. Example:Files- file_general_func, file1, file2, file_main. file1: #include "file_general_func" file2: #include "file_general_func" file_main: #include "file1", #include "file2" After build this script i gets "WARNING: already included file:" Removing the #include "file_general_func" from both files and include it only in "file_main" worked for a while, but after some changes I got error or "undefined function" How can i solve it? Thanks, Shany Link to comment Share on other sites More sharing options...
water Posted November 28, 2012 Share Posted November 28, 2012 You could use directive "#include-once" in your script. So if you include the same file a second time it is ignored. 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...
coolooc Posted November 28, 2012 Author Share Posted November 28, 2012 I got "syntax error" for writing: #include-once "general_func.au3" Link to comment Share on other sites More sharing options...
coolooc Posted November 28, 2012 Author Share Posted November 28, 2012 Oh in the file... sorry. Thanks! Link to comment Share on other sites More sharing options...
water Posted November 28, 2012 Share Posted November 28, 2012 In your script as first "statement": #include-once #include <file1.au3> #include <file2.au3> 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...
Gotemp Posted November 28, 2012 Share Posted November 28, 2012 I maybe wrong here but im not sure as i dont include many files like this but im taking it that most your coding is happening in file_main so if you included the rest in that one wouldnt it pass the information to the rest of the files? File_main.au3 <=== file your coding in #include <file1.au3> #include <file2.au3> #include <file_gen_funcs.au3> ;All other code here Then if you needed to test something in file1 or 2 you could just add #include <gen_funcs.au3> run/test the code and then comment it out/delete it from the top of the script and run it all though File_main again? Like i said maybe im wrong but thts how i would do it if it works. Link to comment Share on other sites More sharing options...
coolooc Posted November 28, 2012 Author Share Posted November 28, 2012 I mentioned it in the first message.I tried to include all the files in the main file, and it worked first, but for some reason after some additions and changes in the code i got error "undefined function". include all the files in the main file may not be the reason, but changing it to #include-once helped.Thank you! Link to comment Share on other sites More sharing options...
water Posted November 28, 2012 Share Posted November 28, 2012 Glad your problem could be solved 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...
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