Jump to content
Sign in to follow this  
proabc123

Help with this script

Recommended Posts

proabc123

I have this script,and i want when i click button 1(OK),if checkbox1 checked msbbox1 show,if checkbox2 checked msgbox2 show,and if checkbox1&checkbox2 checked msgbox1&msgbox2 show.But in my script only button2(cancel) active,button1(ok) not active,can you repair my script.

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("Tabbed Notebook Dialog", 452, 343, 189, 121)

GUISetIcon("D:\005.ico")

$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")

$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 24, 40, 97, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 24, 64, 97, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 24, 112, 97, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 24, 88, 97, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 24, 136, 97, 17)

GUICtrlSetFont(-1, 8, 400, 0, "Arial")

$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")

$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")

GUICtrlCreateTabItem("")

$Button1 = GUICtrlCreateButton("OK", 166, 272, 75, 25, 0)

$Button2 = GUICtrlCreateButton("Cancel", 246, 272, 75, 25, 0)

$Button3 = GUICtrlCreateButton("Help", 328, 272, 75, 25, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Do

$msg = GUIGetMsg()

Select

Case $msg = $Button1

If $msg = $Checkbox1 Then

MsgBox(0,"","assssssssssssss")

ElseIf $msg = $Checkbox2 Then

MsgBox(0,"","akkkkkk")

EndIf

Case $msg = $Button2

$msg = $GUI_EVENT_CLOSE

EndSelect

Until $msg = $GUI_EVENT_CLOSE

Edited by proabc123

Share this post


Link to post
Share on other sites
stampy

Change to:

Case $msg = $Button1
            If BitAnd(GUICtrlRead($Checkbox1 ),$GUI_CHECKED)

etc......
etc......

you need to check if the checkbox is checked, your checking if it's becoming active. Use guictrlread.

Share this post


Link to post
Share on other sites
smashly

Hi,

#include <GUIConstants.au3>

Global $Checkbox[6], $cX = 40

$Form1 = GUICreate("Tabbed Notebook Dialog", 452, 343, 189, 121)
GUISetIcon("D:\005.ico")
$PageControl1 = GUICtrlCreateTab(8, 8, 396, 256)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
$TabSheet1 = GUICtrlCreateTabItem("TabSheet1")
For $i = 1 To 5
    $Checkbox[$i] = GUICtrlCreateCheckbox("Checkbox " & $i, 24, $cX, 97, 17)
    GUICtrlSetFont(-1, 8, 400, 0, "Arial")
    $cX += 24
Next
$TabSheet2 = GUICtrlCreateTabItem("TabSheet2")
$TabSheet3 = GUICtrlCreateTabItem("TabSheet3")
GUICtrlCreateTabItem("")
$Button1 = GUICtrlCreateButton("OK", 166, 272, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Cancel", 246, 272, 75, 25, 0)
$Button3 = GUICtrlCreateButton("Help", 328, 272, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE, $Button2
            Exit
        Case $Button1
            For $i = 1 To 5
                If BitAnd(GUICtrlRead($Checkbox[$i]), $GUI_CHECKED) Then
                    MsgBox(64,"Checkbox " & $i, "Checkbox " & $i & " is Checked.", 1)
                EndIf
            Next
        Case $Button3
            MsgBox(64,"Help", "Not much help is it?", 2)
    EndSwitch
WEnd

Cheers

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  

×