Sign in to follow this  
Followers 0
Mellon

Creating my own include

6 posts in this topic

I have a number of programs that query either the same or sub-sets of the same information. For an example, I have one program that lists a chart list for a specific vessel, I have another that will get me support and shipping history for a specific vessel and I have a third that will get a list of code numbers I need to send the vessel to unlock specific add-on programs.

So I have a couple of newbe questions about this. I will start with a very simple example: I have a list of vessel names I need to get into a Combo. Start this using _FileReadToArray. I them break off part of the line I don't need and use GUICtrlSetData to add the part I do need Combo.

Is it possible or reasonable to populate a Combobox from an include?

Share this post


Link to post
Share on other sites



You can use FileInstall to install it to your compiled program, but an "#include" file is copied to the main script at the point that you have the include directive, so having your file as a raw list of data isn't going to work as an include.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Just to make sure we understand each other I am not thinking about putting the list of vessels as an include. What I am think about would be something like this:

MajorProgram (has #include Get_List_of_Vessel.au3)

---> Need to get list of vessels

---> call a function from (Get_List_of_Vessel.au3)

---> Function in Get_List_of_Vessel.au3 open the file at c:VesselAllVessels.txt

---> Allvessels.txt is processed.

---> Processed text file is added a combobox on the GUI created in MajorProgram

Processing returns back to MajorPrograming.

Even if this is possible I suspect it would be a bad way to do it.

I have standardize the way I do this but I have three useful programs that I wrote before I had much experience. I think I'm gonna have the bit the bullet and do a large rewrite. Must likely just as well :D...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

So they are three .au3 scripts you wrote yourself? If so, there is no reason you could not include them. Just have your functions return arrays, or pass the variables to the function with byref.

Generally things are faster the more you can work in memory rather than spinning up the hard drive.

However from your description, learning sqlite or mysql may be the way to go in your case. It may negate the need for several programs and is quiet powerfull in itself.

Edited by DicatoroftheUSA

Share this post


Link to post
Share on other sites

While I haven't used autoit and mysql I do know mySql. This is an issue in how we maintain the data. Each chart list is unique to the vessel. The program that creates the chart data uses text files as its list. If I was to turn the flat file database to an sql database I would have to maintain both databases and any drift would cause problems. In this case it is easier to use the data I know is being maintained because it has to be maintained.

Share this post


Link to post
Share on other sites

You can certainly write these functions in a separate file (and probably should since you are reusing code). In the case of the combo box example, you would just need to pass a handle of the combo to the function.

Share this post


Link to post
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
Sign in to follow this  
Followers 0