Jump to content

Create Radio Button list from keys in INI


Recommended Posts

I'm new to AutoIt..please forgive me.

I've been working on this problem for a day or two now.

What I'm trying to do is build a simple dialog box consisting of radio buttons. These radio buttons would be pulled from a dynamic list. Essentially the selection of one of the buttons and a subsequent "OK" selection would start a batch file and fire up a separate program.

My thought was to use an INI file. The INI would have only one section "Projects" and then multiple keys after it. The keys would be the descriptive name of the batch file and the value would be the actual batch file name.

So by selection of the radio button, the value would selected and the batch file executed.

I think this is possible, but I'm struggling getting the radio buttons to populate with the INI key names.

The INI format would be;

[Projects]

EAC WF 2.0=EACWF2.BAT

EAC WF 3.0=EACWF3.BAT

EAC WF 4.0=EACWF4.BAT

EAC WF 5.0=EACWF5.BAT

Link to comment
Share on other sites

Here is some of the code I've been playing with just for testing.

#include <GUIConstantsEX.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

Global $vGUI_V=400
Global $vGUI_H=600
Global $iniFile="Projectlist.ini"


GUICreate ("Start Up Selector", $vGUI_V, $vGUI_H)
GUICtrlCreateLabel ("Please select the Project to use", 10,10)
$startline=0
$project = IniReadSection($iniFile,"Projects")
GUISetState()
If @error Then
    MsgBox(4096, "ERROR", "Error occured, no INI or incorrect Sections")
Else
    For $i = 1 To $project[0][0]
    ;msgbox (4096, "KEYS", $project[$i][0])
    GUIctrlcreateradio ($project[$i][0], 10, $startline+25, 60)
    Next
EndIf

Sleep(4500)
Link to comment
Share on other sites

I think this is possible, but I'm struggling getting the radio buttons to populate with the INI key names.

The buttons are all stacking up on top of each other because $startline is not incrementing as expected.

Replace:

GUIctrlcreateradio ($project[$i][0], 10, $startline+25, 60)

With

GUIctrlcreateradio ($project[$i][0], 10, $startline + 25 * $i, 80)
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...