Jump to content
Sign in to follow this  

Help with Checking & Arrays

Recommended Posts

I'm stuck on a problem :/

I'm writing a program that writes to the registry.

I have checkboxes for each type of reg key there is (string, binary,dword etc..)

I am stuck on how to check every checkbox for the checked one. I would assume using arrays would work, but I haven't been able to figure it out.

Here the array code I used.

$check1 - $check2 etc... are the gui checkbox labels

for $x  = 1 to 5  step 1
              if $check($x) = $gui_checked then
                       $valid = $check($x)

When i try to use $valid as the key type in regwrite, it doesn't seem to work. Could it be because in the array $check($x) isn't being read as $check1 etc..?

Thanks in adv.

Edited by acidfear

Share this post

Link to post
Share on other sites


maybe you forgot GuiCtrlRead(variable) = $gui_Checked ...

So long,


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

All the checkbox's are in an array, and the button will loop the array to check the stats.

Note: GUICtrlRead ( $checkboxes[$i], 1 ) just grabs the name.

#include <GUIConstants.au3>
Dim $checkboxes[4]

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Checkbox Check", 315, 310, 193, 115)
$Checkboxes[0] = GUICtrlCreateCheckbox("ACheckbox1", 104, 72, 97, 17)
$Checkboxes[1] = GUICtrlCreateCheckbox("ACheckbox2", 104, 104, 97, 17)
$Checkboxes[2] = GUICtrlCreateCheckbox("ACheckbox3", 104, 136, 97, 17)
$Checkboxes[3] = GUICtrlCreateCheckbox("ACheckbox4", 104, 168, 97, 17)
$Button1 = GUICtrlCreateButton("Check states", 104, 192, 105, 25, 0)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $Button1
            For $i = 0 To UBound ( $checkboxes ) - 1 Step 1
                If GUICtrlRead ( $checkboxes[$i] ) = $GUI_CHECKED Then
                    MsgBox ( 1, GUICtrlRead ( $checkboxes[$i], 1 ), "This checkbox is checked." )
                    MsgBox ( 1, GUICtrlRead ( $checkboxes[$i], 1 ), "This checkbox is not checked." )

Share this post

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
Sign in to follow this  

  • Create New...