Jump to content

little checkbox question

Recommended Posts

i'm kinda new to the gui thing and didnt see anything on this but i could be searching for the wrong thing.

I have a ini file





I know i would do the IniReadSectionNames to get the sections into a array and i know that i can use a for loop to get the section names out with $var[$i], but this is about as far as i can get. i dont know how to make it so that i can auto generate checkboxes out from them and then after that retrive the data from them. I have tried using $var[$i] = GuiCtrlCreateCheckbox($var[$i], and the rest of the info) but as you can guess and i thought that didnt work well. When it comes to getting the information from the check boxes everything that i have seen looks like u need to know exactly the id for the checkbox, but for the autogenerating of them there always going to be different....

anyone have any ideas?

PS i do know that i am bad at explaing myself at time, if you dont understand feel free to say so LOL

Link to post
Share on other sites
  • 3 weeks later...

maybe you should do 2 script! 1 who read the ini and make a second file au3 and then be excuted! you know you ask something like koda who do gui interface from user intervention, the only difference with you is you wanna make it from a ini!

big job in front of you hehe B)

GreenseedMCSE+I, CCNA, A+Canada, QuebecMake Love Around You.

Link to post
Share on other sites

your.ini example

[section One]

Run program=Run What Program?

Command Promp=cmd

Key is the text in the check box, value is what you work with when it is checked

#include <GuiConstants.au3>

Dim $check_boxes, $x = 10, $y = 10
GUICreate("Check Boxes", 500, 500)

$vars = IniReadSection(@ScriptDir & "\your.ini", "Section One")
If @error Then
    MsgBox(4096, "", "Error occured, probably no INI file.")
    For $i = 1 To $vars[0][0]
        If Not IsArray($check_boxes) Then
            Dim $check_boxes[1][2]
        ReDim $check_boxes[$i + 1][2]
        $check_boxes[0][0] = $i
        $check_boxes[$i][0] = GUICtrlCreateCheckbox($vars[$i][0], $x, $y, 120, 20)
        $check_boxes[$i][1] = $vars[$i][1]
        $y = $y + 25

$button = GUICtrlCreateButton("Do Something", 220, 450, 120, 20)

While 1
    $msg = GUIGetMsg()
        Case $msg = $GUI_EVENT_CLOSE
        Case $msg = $button
            For $i = 1 To $check_boxes[0][0]
                If BitAND(GUICtrlRead($check_boxes[$i][0]), $GUI_CHECKED) Then
                    $iMsgBoxAnswer = MsgBox(1, "Do Something", $check_boxes[$i][1])
                        Case $iMsgBoxAnswer = 1;OK
                        Case $iMsgBoxAnswer = 2;Cancel
Edited by gafrost

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

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