AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie question Getting the list of a combo box from a file.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
specter333



Joined: 15 Jan 2007
Posts: 7

PostPosted: Thu Jun 12, 2008 5:31 am    Post subject: Newbie question Getting the list of a combo box from a file. Reply with quote

I hate to ask this since it's most likely been covered before but I'm stuck and haven't been able to find the answer. I've probably found post with answers to my question but didn't know enough to understand it was, so you may be able to just point me to the proper post.

I'm wanting to start off with a simple inventory and assignment gui, after I get this part down I'll expand on it later. I'm wanting a page with combo boxes of what's in stock who's list are filled in from XLM or any other type file that can be simply edited. I've got the gui part but I'm not understanding how to read from a file into the drop down list. I've seen some similar examples that pop up message boxes from a list but not fill in the combo box.

Second question, am I understanding correctly that to identify each combo box on a gui an output variable needs to be assigned to it even if it's not used?

Here is a short, rough example of what it may look like except there would be more combo boxes in more columns where each column would be a scheduled show and the XLM sheet the available inventory in the shop. This of course isn't taking into account the number of each item we have in inventory but I'll take this one lesson at a time.

Code:
Gui, Add, Text, x0 y0 w98 h20 Right, Techs

Gui, Add, Text, x0 y20 w98 h20 Right, Trucks

Gui, Add, Text, x0 y40 w98 h20 Right, FOH Console

Gui, Add, Text, x0 y60 w98 h20 Right, FOH Processing

Gui, Add, Text, x0 y80 w98 h20 Right, Mon Console

Gui, Add, Text, x0 y100 w98 h20 Right, Mon Processing

Gui, Add, ComboBox, x100 y0 w50 h500 , Techs||Art|Dave|Eder|Glen|Rich|Tracy

Gui, Add, ComboBox, x150 y0 w50 h500 , Techs||Art|Dave|Eder|Glen|Rich|Tracy

Gui, Add, ComboBox, x100 y20 w100 h500 , Truck||1|2|3|4|5|6|7|8|Rental 1|Rental 2|Rental 3|Rental 4|Rental 5

Gui, Add, ComboBox, x100 y40 w100 h500 , FOH Console||Heritage 3K|PM3500 #1|PM3500 #2|PM3500 #3

Gui, Add, ComboBox, x100 y60 w100 h500 , FOH Processing||906|901|990|910

Gui, Add, ComboBox, x100 y80 w100 h500 , Mon Console||Crest HP8|Crest LM7|PM3500M|SX1

Gui, Add, ComboBox, x100 y100 w100 h500 , Mon Processing||906 8 mix Ashly|901 8 mix DBX|4 mix DOD

Gui, Show, x131 y91 h377 w477, Inventory and assignment example.



Return

GuiClose:

ExitApp


Finishing this project may be more than I can accomplish so I might be looking to hire someone. If you interested please let me know. It will most likely be a few weeks before I know what I want in the finished product.

If some one knows a better way of going about this please let me know that too. Thanks in advance for any help or info you can give me.
Rich
Back to top
View user's profile Send private message
Klaus



Joined: 12 May 2005
Posts: 205
Location: Münster, Germany

PostPosted: Thu Jun 12, 2008 5:47 am    Post subject: Reply with quote

Hi, specter333,
if you want to read the content of a combo box from a file, you could
create an .INI-file with keys for each box:
Code:
valueBox1=a||b|c
valueBox2=d||e|f

In the initialising phase of you application you can read these values
Code:
IniRead, valueBox1, %nameOfINIFile%, section , valueBox1
and after that you declare your combo boxes
Code:
Gui, Add, ComboBox, x100 y0 w50 h500 vMyComboBox1, %valueBox1%

You should assign a variable to your combo boxes to get access of the chosen entry.
Hope I could help,
Klaus
Back to top
View user's profile Send private message Send e-mail
specter333



Joined: 15 Jan 2007
Posts: 7

PostPosted: Thu Jun 12, 2008 6:38 am    Post subject: ' Reply with quote

Thanks Klaus, that gets me close. I had to do a web search on how to create an ini file. It's at least looking for the data but all I get is "ERROR" in the combo box.

Here's the ini file named xxx.
Code:

[section]
valueBox1=a||b|c
valueBox2=d||e|f


and here's the script.
Code:


IniRead, valueBox1, %xxx%, section , valueBox1

Gui, Add, ComboBox, x100 y0 w50 h500 vMyComboBox1, %valueBox1%

Gui, Show, x131 y91 h377 w477, I




Return

GuiClose:

ExitApp


It does look for the ini file in the same directory as itself correct?
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Thu Jun 12, 2008 7:00 am    Post subject: Reply with quote

Unless you define xxx=xxx.ini it won't work, it should just be the filepath+filename:

%A_ScriptDir%\xxx.ini
Back to top
View user's profile Send private message
specter333



Joined: 15 Jan 2007
Posts: 7

PostPosted: Thu Jun 12, 2008 7:21 am    Post subject: Reply with quote

Wow, That's great Hugo. It's working just as it should now. That was easy with the right examples to follow.

Thank you both for your quick responses. I'm sure I'll be asking more questions later when I'm trying to figure out how to track the count of each item.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Thu Jun 12, 2008 7:45 am    Post subject: Reply with quote

Counter:
- Read value from ini
- Add/Substract
- Write back to ini
- Update GUI if needed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group