Jump to content

IniReadSection with ComboBox Drop down integration

Recommended Posts

Trying to get this combo box drop down to read the data within my ini section names. Not able to return the key=value data when I hit the button on the gui. I can't seem to get the IniReadSection to recognize anything based off of my selection. What am I missing here?


#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

#Region ### START Koda GUI section ### Form=
; original script borrowed from InunoTaishou and Subz
$Form1 = GUICreate("Sample", 413, 213, 192, 124)
$Combo1 = GUICtrlCreateCombo("", 80, 24, 241, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Button1 = GUICtrlCreateButton("Submit", 152, 56, 75, 25)
#EndRegion ### END Koda GUI section ###

; Get the sections of the ini file
Global $iFile = @ScriptDir & "\test5.ini"
Global $aSections = IniReadSectionNames($iFile)
; If the IniReadSectionNames succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1]
If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1])

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            $test = IniReadSection($iFile, $aSections)
            MsgBox($MB_SYSTEMMODAL, "", $test)

I've attached my sample ini data too.


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...