Sign in to follow this  
Followers 0
djinius

How to transpose .ini values into a combobox

2 posts in this topic

I'm trying to make a combo box have its values read from a .ini file...

$menu1 = GUICtrlCreateCombo("Combo4", 96, 304, 97, 25)

GUICtrlSetData(-1,"|1|2|3|,"Value 1")

Instead of having 1 2 and 3 written in the script, how can I have those values be read from a .ini file where these same values would be written... How much I format the .ini file ?

Share this post


Link to post
Share on other sites



Here is a quick example:

#include <GUIConstants.au3>
#Include <GuiComboBox.au3>


$hForm = GUICreate("Combo INI Example", 227, 111, 275, 328)
$oCombo = GUICtrlCreateCombo("", 16, 32, 193, 25)
$oLoad = GUICtrlCreateButton("Load", 16, 72, 97, 25, 0)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $oLoad
            _LoadValues()
    EndSwitch
WEnd

Func _LoadValues()
    Local $aValues
    If Not FileExists(@ScriptDir & "\Example.ini") Then ; create ini if it doesnt exist
        IniWrite(@ScriptDir & "\Example.ini", "Main Section", "Fruit", "Apple")
        IniWrite(@ScriptDir & "\Example.ini", "Main Section", "Vegetable", "Pickle")
        IniWrite(@ScriptDir & "\Example.ini", "Main Section", "Color", "Blue")
        IniWrite(@ScriptDir & "\Example.ini", "Main Section", "Car", "Nissan")
    EndIf
    $aValues = IniReadSection(@ScriptDir & "\Example.ini", "Main Section")
    For $i = 1 To UBound($aValues) - 1
        _GUICtrlComboBox_AddString($oCombo, $aValues[$i][1])
    Next
EndFunc   ;==>_LoadValues

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)

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