Sign in to follow this  
Followers 0
Infinitex0

CheckBox help

7 posts in this topic

I'm making a script that is basically a quiz. You check the box with the right text by it and click next. But the thing that I have no idea about is (a) line(s) that can tell in the end how many (if any) questions you got right.

Also is it possible to only have one checkBox checked? :o


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites



i suggest start with

Dim Question_[21] ; this is for 20 questions

Dim $checkBx_[21] ; need one for each question

$answers = StringSplit("answr1,answr2,bla,bla,", ",") ; 20 answers

guicreate()

for $x = 1 to 20

$chckBx_[$x] = guictreatecheckbox()

$Question_[$x] = guicreatelabel()

next

thats a heck of a start

hope that helps

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

No idea how to use that.

#include <GUIConstants.au3>

GUICreate("Math1",265,150); will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Math Junk2", 1, 1)

$check00 = GUICtrlCreateCheckbox ("A:Math Junk3",     10, 15, 120, 20)
$check01 = GUICtrlCreateCheckbox ("B:Math Junk4",     10, 35, 120, 20)
$check02 = GUICtrlCreateCheckbox ("C:Math Junk5",     10, 60, 120, 20)
$check03 = GUICtrlCreateCheckbox ("D:Math Junk6",     10, 85, 120, 20)
$nextbutton = GUICtrlCreateButton("Next",                   10, 110, 50, 20)
GUISetState(@SW_SHOW)    ; will display an  dialog box with 1 checkbox

; Run the GUI until the dialog is closed

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $nextbutton 
    $GUIC = GUICreate("Math7",275,150)
          GUICtrlCreateLabel("Math Junk8",1,1)
$check04 = GUICtrlCreateCheckbox ("A:Math Junk9",              10, 15, 120, 20)     
$check05 = GUICtrlCreateCheckbox ("B:Math Junk10",             10, 35, 120, 20)
$check06 = GUICtrlCreateCheckbox ("C:Math Junk11",             10, 60, 120, 20)
$check07 = GUICtrlCreateCheckbox ("D:Math Junk12",             10, 85, 120, 20)
$nextbutton1 = GUICtrlCreateButton("Next",                         10, 110, 50, 20)
        GUISetState(@SW_SHOW)
        
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

Could you tell me where to put those lines that you gave me?

Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
While 1
GUICreate("A",265,150) ; will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Finish The Following Statement: I'm __________ Bitch!", 1, 1)

$check00 = GUICtrlCreateCheckbox ("A:B", 10, 15, 120, 20)
$check01 = GUICtrlCreateCheckbox ("B:C",         10, 35, 120, 20)
$check02 = GUICtrlCreateCheckbox ("C:R",     10, 60, 120, 20)
$check03 = GUICtrlCreateCheckbox ("D:D",      10, 85, 120, 20)
$nextbutton = GUICtrlCreateButton("Next",            10, 110, 50, 20)
GUISetState(@SW_SHOW)     ; will display an  dialog box with 1 checkbox
$msg = $GUI_EVENT_CLOSE
  ExitLoop 
WEnd

; Run the GUI until the dialog is closed

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $nextbutton 
        GUICreate("FHI",275,150)
        GUICtrlCreateLabel("Finish The Following Statement: Fuck Your _______ Bitch!",1,1)
$check04 = GUICtrlCreateCheckbox ("A:h",          10, 15, 120, 20)      
$check05 = GUICtrlCreateCheckbox ("B:c",          10, 35, 120, 20)
$check06 = GUICtrlCreateCheckbox ("C:s",          10, 60, 120, 20)
$check07 = GUICtrlCreateCheckbox ("D:c",          10, 85, 120, 20)
$nextbutton2 = GUICtrlCreateButton("Next",          10, 110, 50, 20)
GUISetState(@SW_SHOW)
Case $msg = $GUI_EVENT_CLOSE
      Exit
  EndSelect
WEnd 



While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $nextbutton2
        GUICreate("FGHY",295,150)       
        GUICtrlCreateLabel("HGG",1,1) 
$check08 = GUICtrlCreateCheckbox ("A:B",     10,  15, 120, 20) 
$check09 = GUICtrlCreateCheckbox ("B:E",        10,  35, 120, 20)
$check10 = GUICtrlCreateCheckbox ("C:W",    10,  60, 120, 20)
$check11 = GUICtrlCreateCheckbox ("D:B",    10,  85, 120, 20)
$nextbutton3 = GUICtrlCreateButton("Next",                       10, 110,  50, 20)
GUISetState(@SW_SHOW)
    Case $msg = $GUI_EVENT_CLOSE
      Exit 
  EndSelect
  WEnd

Whenever I start This up I can get through the first box but then when when I get to the second box and click "Next", nothing happens anyone know why?


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Share this post


Link to post
Share on other sites

maybe this.... with out bad language

#include <GUIConstants.au3>

GUICreate("A",265,150); will create a dialog box that when displayed is centered
GUICtrlCreateLabel("Finish The Following Statement: I __________ My Mom 8)", 1, 1)

$check00 = GUICtrlCreateCheckbox ("A:B", 10, 15, 120, 20)
$check01 = GUICtrlCreateCheckbox ("B:C",         10, 35, 120, 20)
$check02 = GUICtrlCreateCheckbox ("C:R",     10, 60, 120, 20)
$check03 = GUICtrlCreateCheckbox ("D:D",      10, 85, 120, 20)
$nextbutton = GUICtrlCreateButton("Next",            10, 110, 50, 20)
GUISetState(@SW_SHOW)    ; will display an  dialog box with 1 checkbox


While 1; Run the GUI until the dialog is closed
    
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then Exit
    
    If $msg = $nextbutton Then
        check_answers()
        ExitLoop
    EndIf
WEnd

GUICreate("FHI",275,150)
        GUICtrlCreateLabel("Finish The Following Statement: I _______ My Dad",1,1)
$check04 = GUICtrlCreateCheckbox ("A:h",          10, 15, 120, 20)      
$check05 = GUICtrlCreateCheckbox ("B:c",          10, 35, 120, 20)
$check06 = GUICtrlCreateCheckbox ("C:s",          10, 60, 120, 20)
$check07 = GUICtrlCreateCheckbox ("D:c",          10, 85, 120, 20)
$nextbutton2 = GUICtrlCreateButton("Next",          10, 110, 50, 20)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $nextbutton2
        check_answers()
        ExitLoop
    Case $msg = $GUI_EVENT_CLOSE
      Exit
  EndSelect
WEnd

 GUICreate("FGHY",295,150)      
        GUICtrlCreateLabel("HGG",1,1)
$check08 = GUICtrlCreateCheckbox ("A:B",     10,  15, 120, 20)
$check09 = GUICtrlCreateCheckbox ("B:E",        10,  35, 120, 20)
$check10 = GUICtrlCreateCheckbox ("C:W",    10,  60, 120, 20)
$check11 = GUICtrlCreateCheckbox ("D:B",    10,  85, 120, 20)
$nextbutton3 = GUICtrlCreateButton("Next",                       10, 110,  50, 20)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()
  Select
    Case $msg = $nextbutton3
       check_answers()
      ; last one
       Exit
    Case $msg = $GUI_EVENT_CLOSE
      Exit
  EndSelect
  WEnd
  
; ------------------------- Functions --------------------------

Func check_answers()
    MsgBox(64, " Checking ", " Now checking answers   no foul language needed in forums!")
EndFunc

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <GUIConstants.au3>

_Main()

Func _Main()
    Local $checkbox[12], $nextbutton
    Local $s_text[12] = ["A:B", "B:C", "C:R", "D:D", "A:h", "B:c", "C:s", "D:c", "A:B", "B:E", "C:W", "D:B"]
    Local $s_guis[3] = ["A", "FHI", "FGHY"]
    Local $s_labels[3] = ["Finish The Following Statement: I __________ My Mom 8)", _
            "Finish The Following Statement: I _______ My Dad", "HGG"]
    
    Local $n_gui, $msg, $start = 0, $end = 3
    
    For $n_gui = 0 To 2
        GUICreate($s_guis[$n_gui], 265, 150); will create a dialog box that when displayed is centered
        GUICtrlCreateLabel($s_labels[$n_gui], 1, 1)
        
        _CreateDisplay($checkbox, $nextbutton, $s_text, $start, $end)
        GUISetState(@SW_SHOW)   ; will display an  dialog box with 1 checkbox
        
        
        While 1; Run the GUI until the dialog is closed
            
            $msg = GUIGetMsg()
            
            If $msg = $GUI_EVENT_CLOSE Then Exit
            
            If $msg = $nextbutton Then
                check_answers($checkbox, $s_text, $start, $end)
                ExitLoop
            EndIf
        WEnd
        GUISetState(@SW_HIDE)
;~      GUIDelete()
        $start = $end + 1
        $end += 4
    Next
EndFunc  ;==>_Main

; ------------------------- Functions --------------------------

Func check_answers(ByRef $a_checkboxes, ByRef $s_text, ByRef $start, ByRef $end)
    ConsoleWrite($start & @LF & $end & @LF)
    Local $x, $s_checked
    For $x = $start To $end
        If BitAND(GUICtrlRead($a_checkboxes[$x]), $GUI_CHECKED) = $GUI_CHECKED Then
            $s_checked = $s_checked & $s_text[$x] & @LF
        EndIf
    Next
    
    MsgBox(64, " Checking ", " Now checking answers   no foul language needed in forums!" & @CRLF & @CRLF & $s_checked)
EndFunc  ;==>check_answers

Func _CreateDisplay(ByRef $a_checkboxes, ByRef $nextbutton, ByRef $s_text, ByRef $start, ByRef $end)
    Local $y = 15, $x
    For $x = $start To $end
        $a_checkboxes[$x] = GUICtrlCreateCheckbox($s_text[$x], 10, $y, 120, 20)
        $y += 20
    Next
    $nextbutton = GUICtrlCreateButton("Next", 10, $y + 5, 50, 20)
EndFunc  ;==>_CreateDisplay

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.

 

Share this post


Link to post
Share on other sites

:o Crap. (I' m going to beat the heck out of my brother) He's always doing stupid crap like this. I gotta start logging off.)

SORRY SORRY SORRY :geek:


The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

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