Xiengsaephan Posted July 13, 2017 Share Posted July 13, 2017 I have a combobox that reads to an .ini files that loads 3 values to the GUI, you can edit these values and save them. I want to add a button to the interface that users can then click on to add a new item to that combobox directly from the GUI which would add a new section in the .ini file as well. What command would work best for this? My .ini would look like this [ComboList Item 1] val1 = 1111 val2 = 2222 val3 = 3333 [ComboList Item 2] val1 = 4444 val2 = 5555 val3 = 6666 Link to comment Share on other sites More sharing options...
KickStarter15 Posted July 13, 2017 Share Posted July 13, 2017 @Xiengsaephan, FileWriteLine() and FileWrite() can be used for this. #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 438, 192, 124) $Combo1 = GUICtrlCreateCombo("", 40, 24, 201, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData($Combo1, "Item 1|Item 2") $Button1 = GUICtrlCreateButton("Button1", 32, 56, 57, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 Local $file = FileOpen(@ScriptDir & "\Your.ini", 1) FileWriteLine($file, GUICtrlRead($Combo1)) FileClose($file) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd KS15 Xiengsaephan 1 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. 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