DiscoEd Posted November 7, 2009 Share Posted November 7, 2009 Greetings, O.k. I've got this Autoit (work related) project that I've been working on for about a year. It started out small, but the scope of the project and the script(s) keep getting larger. For this project I have written several scripts that keep a similar appearance and have similar functions in many cases. The problem that has developed is that I'm starting to have trouble managing changes to what is essentially the same GUI code across these several scripts. I've been trying to approach this problem using includes, but while that seems to work for non GUI related functions, I'm running into problems when it comes to things such as creating a new GUI window (with controls) from a function within an include file. To better describe the scenario... 1. I have a main GUI window with two Tabs and numerous controls on each of those tabs. These are created by the main script. 2. Then I want a third Tab with controls which is used for program config settings. The same code for this third Tab can be used across several other "main" scripts. 3. When I try to work this out by creating an include files containing the controls and logic for the third tab I start to run into problems with the controls showing up as not being declared. I was able to clear some of these up by declaring values globally either in the include or by declaring the variables before the include is called by the main script. 4. I also tried another approach of trying to have the include file create a whole new GUI window which would just have the needed configuration controls and which could simply be closed when the config was done. You would then go back to the using the main script GUI. Bottom line is that I want to have some code that I can reuse in multiple scripts and maintain in only one place. Is there some one who could point me in the direction of some help in how to do this in a professional sort of way? I guess what I'm looking for would be something along the lines of a "best Autoit GUI practices" or a "best practices with Autoit includes" type of guide. Perhaps the real problem is that Autoit is just too powerful and awesome, had Autoit been wimpy and useless my project would have never grown to what it is today. Doh! Thanks in Advance, DiscoEd Link to comment Share on other sites More sharing options...
KaFu Posted November 7, 2009 Share Posted November 7, 2009 - Use KODA to design the GUI - Always use the same control names - Put the GUI code into an include file - To add a variable to the KODA GUI, declare it first in the target script before including the GUI $sGUI_Name = "GUI Test Name 1" #include <_Default_GUI.au3> while you declare the GUI name in Koda something like "" & $sGUI_Name & "" OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Zedna Posted November 7, 2009 Share Posted November 7, 2009 If you have troubles with not declared constants then make new helper include file <All_GUI_Constants.au3> containing all GUI constants include files and add it at top of your include _Default_GUI.au3 #include <All_GUI_Constants.au3> ---> #include <AVIConstants.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> ... all other *Constants.au3 files here ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
MvGulik Posted November 7, 2009 Share Posted November 7, 2009 Sound to me like this could use some sort of used.tabs and used.controls management system. Though I'm probably looking at it from a wrong and overly complicated point of view. "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
PartyPooper Posted November 8, 2009 Share Posted November 8, 2009 Use the Snippet Holder in SciTE4AutoIt3 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