Jump to content

for looping


Zithen
 Share

Recommended Posts

have this gui has 2 for loops, the frist one work great, but down in the case statment for hitting $DelBtnGo it will do the first msg box but never enter the for loop or just by passes it. I tried a few options but get the same results...

if someone can take a look and let me know what i screwed up that would be great thanks

Global $name
    Global $check[20]
    Global $delini
    Global $x = 10
    Global $y = 30
    
    
    $name = IniReadSectionNames($file)
    If @error Then
        MsgBox(48, "Error", "Error: Can not read save file." & @CR & @CR & "Error: 1084")
    Else
        GUICreate("Delete Printers", 400, 230)
        For $i = 1 To $name[0]
            $name1 = IniRead($file, $name[$i], "name", "null")
            $check[$i] = GUICtrlCreateCheckbox($name1, 10, $y, 200, 10)
            $y = $y + 20
        Next
        $DelLbl = GUICtrlCreateLabel("Please check the printers you would like to delete.", 80, 10, 250, 20)
        $DelBtnAll = GUICtrlCreateButton("Delete All", 100, 190, 70, 30)
        $DelBtnGo = GUICtrlCreateButton("Delete Selected", 210, 190, 85, 30)
    EndIf
    
    GUISetState()
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $DelBtnAll
                deleteallprinters()
            Case $msg = $DelBtnGo
                MsgBox(0,"test","1")
                For $i = 1 To $check[0]
                    MsgBox(0,"test","2")
                    $chb_state = GUICtrlRead($check[$i])
                    msgbox(0,"test",$chb_state)
                    If $chb_state = $GUI_CHECKED Then
                        MsgBox(0, "staus", "deleting" & $name[$i])
                    Else
                        MsgBox(0, "staus", "not deleting" & $name[$i])
                    EndIf
                Next
        EndSelect
    WEnd
    Exit
Link to comment
Share on other sites

  • Developers

have this gui has 2 for loops, the frist one work great, but down in the case statment for hitting $DelBtnGo it will do the first msg box but never enter the for loop or just by passes it. I tried a few options but get the same results...

if someone can take a look and let me know what i screwed up that would be great thanks

What is the value of $check[0], don't see you setting it anywhere ?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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