Jump to content

IniReadSectionNames ( "filename" ) Question


Recommended Posts

Im not to familiar with combo Boxes, But if you could post an example of one you are working with, ill see what i can do.

Edit: If you dont want to, i suppose someone else will be along to figure it out for you.

~Shakala

Edited by Shakala
Link to comment
Share on other sites

Im not to familiar with combo Boxes, But if you could post an example of one you are working with, ill see what i can do.

Edit: If you dont want to, i suppose someone else will be along to figure it out for you.

~Rycon

ok sorry about taking so long to answer. was busy. here is the code:

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

$Form1 = GUICreate("Form1", 395, 228, 192, 124)
$combobox = GUICtrlCreateCombo("", 16, 64, 361, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
$Populate = GUICtrlCreateButton("Populate", 24, 96, 347, 97)
GUISetState(@SW_SHOW)


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

Func Populate()
$var = IniReadSectionNames(@ScriptDir & "\save.ini")
For $i = 1 To $var[0]
        GUICtrlSetData($combobox, $var[$i])
    Next
EndFunc

and here is ini to test it:

[Pop1]
key=bla
[Pop2]
key=bla
[Pop3]
key=bla
[Pop4]
key=bla
[Pop5]
key=bla
[This is the Name i don't want to be seen in the combobox]
key=bla
Link to comment
Share on other sites

Honestly, Im not sure if this is what you were looking for, but it seems to be something that you could work with.

What it does is it saves the info under the section name like it was doing in the combo box, but it saves it under $Hidden

and keeps it from being shown in the combo box.

Like i said, im not sure if this is what you wanted, and if its not, just say so lol

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

$Form1 = GUICreate("Form1", 395, 228, 192, 124)
$combobox = GUICtrlCreateCombo("", 16, 64, 361, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Populate = GUICtrlCreateButton("Populate", 24, 96, 347, 97)
GUISetState(@SW_SHOW)


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

Func Populate()
    $var = IniReadSectionNames(@ScriptDir & "\save.ini")
    For $i = 1 To $var[0]
        If $var[$i] = "asdf" Then
            $Hidden = IniReadSection(@ScriptDir & "Save.ini", "asdf")
        Else
            GUICtrlSetData($combobox, $var[$i])
        EndIf
    Next

EndFunc   ;==>Populate

the ini

[Pop1]
key=bla
[Pop2]
key=bla
[Pop3]
key=bla
[Pop4]
key=bla
[Pop5]
key=bla
[asdf]
key=bla

~Shakala

Edited by Shakala
Link to comment
Share on other sites

Maybe this? I haven't tested this so I don't know.

Func Populate()
$var = IniReadSectionNames(@ScriptDir & "\save.ini")
For $i = 1 To $var[0]
        If StringinStr($var[$i], "Pop") Then GUICtrlSetData($combobox, $var[$i]) ; ==<
    Next
EndFunc

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Maybe this? I haven't tested this so I don't know.

Func Populate()
$var = IniReadSectionNames(@ScriptDir & "\save.ini")
For $i = 1 To $var[0]
        If StringinStr($var[$i], "Pop") Then GUICtrlSetData($combobox, $var[$i]) ; ==<
    Next
EndFunc

thanks but the ini file will have totally different names i just used "pop" in the as an example

Edit: hey man i now understand what you were doing here, though i had to change it around i got it to work with my code. thanks for the help.

Edited by Tiboi
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...