Jump to content

combo list from ini file


Recommended Posts

good morning everybody. is there a way to use the guictrlcreatecombo, then the next line would be

GUICtrlSetData(-1, "whatever1|whatever2|....etc")

but instead of setting the data within the script, put it in an ini file, and have the gui read that file to fill the list? i have a program that I put on many pc's and instead of updating the compiled script on each, i would rather edit the ini file whenever i need to, and all of the pc's will see the new info. is this possible to read all of the keys from a section of an ini file and put it as the set data? Thanks!

byteme

Link to post
Share on other sites

here's a piece from the CodeWizard might help to look at that.

$T_STR = ""
$ARRAY = IniReadSection(@ScriptDir & "\colors.ini", "SCHEMES")
If @error Then
    MsgBox(4096, "Error occured", ", Error reading : " & @ScriptDir & "\colors.ini file.")
    Exit
Else
    For $I = 1 To $ARRAY[0][0]
        If (StringLen($T_STR) == 0) Then
            $T_STR = $ARRAY[$I][1]
        Else
            $T_STR = $T_STR & "|" & $ARRAY[$I][1]
        EndIf
    Next
EndIf

$COLORSCHEME = GUICtrlCreateCombo("", 165, 60, 125, -1, $CBS_DROPDOWNLIST); create first item
GUICtrlSetData($COLORSCHEME, $T_STR, $ARRAY[1][1]); add other items

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to post
Share on other sites

you can use gafrost way or this way:

$COLORSCHEME = GUICtrlCreateCombo("", 165, 60, 125, -1, $CBS_DROPDOWNLIST); create first item

$ARRAY = IniReadSection(@ScriptDir & "\colors.ini", "SCHEMES")

If @error Then

MsgBox(4096, "Error occured", ", Error reading : " & @ScriptDir & "\colors.inifile.")

Exit

Else

For $I = 1 To $ARRAY[0][0]

_GUICtrlComboAddString($COLORSCHEME , $ARRAY[$x][0]) ;add other items

Next

EndIf

EITHER WAY SHOULD WORK, GOOD LUCK!!!

Edited by Danny35d
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to post
Share on other sites

thank you all for your help. I was able to get my script to work. Thanks again!

-condoman--

nice script! i have pics all over my pc, so I think I might borrow your program to help me look at them easier....Thanks!

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...