Sign in to follow this  
Followers 0
homincompany

Help with Checkboxes to execute multiple au3(s)

2 posts in this topic

Hello.

thank you for taking your time to read this.

I really need help.

I wrote a few different au3(s). and I want to have a main control GUI window has the list of these au3(s), and checkboxes next to them. In that case, from the list, the user should be able to choose which au3(exe) to run (one or more).

If there is 5 au3(s), then sometimes the user wants to run (1,3,5) or (1,5) or (1,2), or etc.......

I thought in order for me to achieve this task would be using checkboxes. au3(s) with only boxes are checked will be executedby using 'if' statement.

the checkbox In GUI(Main Window) isn't checked, then the process should be ended, and if the checkbox is checked in GUI(main window), then GUI(Account Creation) window should be popped, and continued...

Please help me....I have been playing with 'if' statement but can't figure it out.

Thank you all.!!!

My code:

#include <GuiConstants.au3>

$answer1 = GuiCreate("Main window", 350, 400)

$Check_100 = GuiCtrlCreateCheckbox("", 30, 31)

$Check_101 = GuiCtrlSetState("0", $GUI_CHECKED)

$Label_101 = GuiCtrlCreateLabel("Execute xxxxxxx", 60, 30, 200, 41)

$button10 = GuiCtrlCreateButton("OK", 110, 360, 130, 20)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

;When 'X' button is pressed, quit the process

Case $msg = $button10

$data200 = GUICtrlRead($Check_100)

ExitLoop

EndSelect

WEnd

GuiCreate("Account Creation", 390, 480)

$Label_10 = GuiCtrlCreateLabel("Your SERVER", 30, 50, 200, 21)

$IP_10 = GuiCtrlCreateinput("", 30, 70, 130, 21)

$Label_30 = GuiCtrlCreateLabel("User Name", 30, 100, 131, 21)

$UserName_30 = GuiCtrlCreateinput("xxxx", 30, 120, 130, 21)

$Label_31 = GuiCtrlCreateLabel("Password", 200, 100, 131, 21)

$Password_31 = GuiCtrlCreateinput("xxxx", 200, 120, 130, 21)

$Label_1 = GuiCtrlCreateLabel("New Branch Name", 30, 150, 131, 21)

$BranchName_1 = GuiCtrlCreateinput("", 30, 170, 130, 21)

$Label_2 = GuiCtrlCreateLabel("Address 1", 30, 200, 131, 21)

$Street_2 = GuiCtrlCreateinput("1234 xxxx way", 30, 220, 130, 21)

$Label_3 = GuiCtrlCreateLabel("City", 200, 200, 131, 21)

$City_3 = GuiCtrlCreateinput("", 200, 220, 130, 21)

$Label_4 = GuiCtrlCreateLabel("State", 30, 250, 131, 21)

$State_4 = GuiCtrlCreatelabel("", 30, 270, 130, 21, 0x1000)

$Label_5 = GuiCtrlCreateLabel("Country", 200, 250, 131, 21)

$Country_5 = GuiCtrlCreatelabel("United States", 200, 270, 130, 21, 0x1000)

$Label_6 = GuiCtrlCreateLabel("Zip", 30, 300, 131, 21)

$Zip_6 = GuiCtrlCreateinput("90000", 30, 320, 130, 21)

$Label_7 = GuiCtrlCreateLabel("Branch Phone No.", 200, 300, 131, 21)

$BranchPhone_7 = GuiCtrlCreateinput("123-123-1234", 200, 320, 130, 21)

$Label_8 = GuiCtrlCreateLabel("Contact Person", 30, 350, 131, 21)

$Contact_8 = GuiCtrlCreateinput("", 30, 370, 130, 21)

$Label_9 = GuiCtrlCreateLabel("Contact Person No.", 200, 350, 131, 21)

$ContactPhone_9 = GuiCtrlCreateinput("987-789-0000", 200, 370, 130, 21)

$button1 = GuiCtrlCreateButton("Create", 115, 420, 130, 30)

GuiSetState()

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

;When 'X' button is pressed, quit the process

Case $msg = $button1

$data10 = GUICtrlRead($UserName_30)

$data11 = GUICtrlRead($Password_31)

$data12 = GUICtrlRead($IP_10)

$data1 = GUICtrlRead($BranchName_1)

$data2 = GUICtrlRead($Street_2)

$data3 = GUICtrlRead($City_3)

$data4 = GUICtrlRead($State_4)

$data5 = GUICtrlRead($Country_5)

$data6 = GUICtrlRead($Zip_6)

$data7 = GUICtrlRead($BranchPhone_7)

$data8 = GUICtrlRead($Contact_8)

$data9 = GUICtrlRead($ContactPhone_9)

Share this post


Link to post
Share on other sites



Welcome to AutoIt. This should do the trick.

#include <GuiConstants.au3>

Local $ControlID
Local $AnyCheckboxSelected = False

$answer1 = GUICreate("Main window", 350, 400)
$Check_100 = GUICtrlCreateCheckbox("Execute Script 1", 30, 30, 200, 40)
$Check_101 = GUICtrlCreateCheckbox("Execute Script 2", 30, 60, 200, 40)
$Check_102 = GUICtrlCreateCheckbox("Execute Script 3", 30, 90, 200, 40)
$Check_103 = GUICtrlCreateCheckbox("Execute Script 4", 30, 120, 200, 40)
$Check_104 = GUICtrlCreateCheckbox("Execute Script 5", 30, 150, 200, 40)
$button10 = GUICtrlCreateButton("OK", 110, 360, 130, 20)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        ;When 'X' button is pressed, quit the process
        Case $msg = $button10
            For $x = 1 To 5
                $ControlID = Eval('Check_' & 99 + $x)
                If BitAND(GUICtrlRead($ControlID), $GUI_CHECKED) = $GUI_CHECKED Then
                    $AnyCheckboxSelected = True
                    Switch $x
                        Case 1
                            MsgBox(0, 'Execute', 'Execute Script ' & $x)
                        Case 2
                            MsgBox(0, 'Execute', 'Execute Script ' & $x)
                        Case 3
                            MsgBox(0, 'Execute', 'Execute Script ' & $x)
                        Case 4
                            MsgBox(0, 'Execute', 'Execute Script ' & $x)
                        Case 5
                            MsgBox(0, 'Execute', 'Execute Script ' & $x)
                    EndSwitch
                EndIf
            Next
            If Not $AnyCheckboxSelected Then Exit
            GUIDelete($answer1)
            ExitLoop
    EndSelect
WEnd


GUICreate("Account Creation", 390, 480)
$Label_10 = GUICtrlCreateLabel("Your SERVER", 30, 50, 200, 21)
$IP_10 = GUICtrlCreateInput("", 30, 70, 130, 21)
$Label_30 = GUICtrlCreateLabel("User Name", 30, 100, 131, 21)
$UserName_30 = GUICtrlCreateInput("xxxx", 30, 120, 130, 21)
$Label_31 = GUICtrlCreateLabel("Password", 200, 100, 131, 21)
$Password_31 = GUICtrlCreateInput("xxxx", 200, 120, 130, 21)
$Label_1 = GUICtrlCreateLabel("New Branch Name", 30, 150, 131, 21)
$BranchName_1 = GUICtrlCreateInput("", 30, 170, 130, 21)
$Label_2 = GUICtrlCreateLabel("Address 1", 30, 200, 131, 21)
$Street_2 = GUICtrlCreateInput("1234 xxxx way", 30, 220, 130, 21)
$Label_3 = GUICtrlCreateLabel("City", 200, 200, 131, 21)
$City_3 = GUICtrlCreateInput("", 200, 220, 130, 21)
$Label_4 = GUICtrlCreateLabel("State", 30, 250, 131, 21)
$State_4 = GUICtrlCreateLabel("", 30, 270, 130, 21, 0x1000)
$Label_5 = GUICtrlCreateLabel("Country", 200, 250, 131, 21)
$Country_5 = GUICtrlCreateLabel("United States", 200, 270, 130, 21, 0x1000)
$Label_6 = GUICtrlCreateLabel("Zip", 30, 300, 131, 21)
$Zip_6 = GUICtrlCreateInput("90000", 30, 320, 130, 21)
$Label_7 = GUICtrlCreateLabel("Branch Phone No.", 200, 300, 131, 21)
$BranchPhone_7 = GUICtrlCreateInput("123-123-1234", 200, 320, 130, 21)
$Label_8 = GUICtrlCreateLabel("Contact Person", 30, 350, 131, 21)
$Contact_8 = GUICtrlCreateInput("", 30, 370, 130, 21)
$Label_9 = GUICtrlCreateLabel("Contact Person No.", 200, 350, 131, 21)
$ContactPhone_9 = GUICtrlCreateInput("987-789-0000", 200, 370, 130, 21)

$button1 = GUICtrlCreateButton("Create", 115, 420, 130, 30)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE

            ExitLoop
        ;When 'X' button is pressed, quit the process
        Case $msg = $button1
            $data10 = GUICtrlRead($UserName_30)
            $data11 = GUICtrlRead($Password_31)
            $data12 = GUICtrlRead($IP_10)
            $data1 = GUICtrlRead($BranchName_1)
            $data2 = GUICtrlRead($Street_2)
            $data3 = GUICtrlRead($City_3)
            $data4 = GUICtrlRead($State_4)
            $data5 = GUICtrlRead($Country_5)
            $data6 = GUICtrlRead($Zip_6)
            $data7 = GUICtrlRead($BranchPhone_7)
            $data8 = GUICtrlRead($Contact_8)
            $data9 = GUICtrlRead($ContactPhone_9)
    EndSelect
WEnd

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line

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  
Followers 0