Jump to content

Checkbox


 Share

Recommended Posts

Hello,

Does anyone know how to create a checkbox, like hitmanpro: you check a checkbox and then push a start button and the programs that are checked will start but unchecked programs will not start. Does anyone know how to do that?

Thanks,

PcExpert

Edited by PcExpert
Link to comment
Share on other sites

Hello,

Does anyone know how to create a checkbox, like hitmanpro: you check a checkbox and then push a start button and the programs that are checked will start but unchecked programs will not start. Does anyone know how to do that?

Thanks,

PcExpert

You will need to use GUICtrlRead


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Pls tell more :lmao: Maybe you could show me the path in other forum where i pasted the code

Here is a basic example I found on the GUI forum

#include <GUIConstants.au3>
GUICreate("")
$CHECK = GUICtrlCreateCheckbox(" CHECKBOX", 10, 10, 120, 20)
$DONE = GUICtrlCreateButton("done", 20, 40, 60, 25)
GUISetState()
While 1
    $MSG = GUIGetMsg()
    $READ2 = GUICtrlRead($CHECK)
    
    If $MSG = $DONE Then
        If $READ2 = $GUI_CHECKED Then
            $II = MsgBox(262145, "", "checked")
        ElseIf $READ2 = $GUI_UNCHECKED Then
            $II = MsgBox(262145, "", "unchecked")
        EndIf
    EndIf
    If $MSG = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

How can I add more checkboxes to check?

Here is a basic example I found on the GUI forum

#include <GUIConstants.au3>
GUICreate("")
$CHECK = GUICtrlCreateCheckbox(" CHECKBOX", 10, 10, 120, 20)
$DONE = GUICtrlCreateButton("done", 20, 40, 60, 25)
GUISetState()
While 1
    $MSG = GUIGetMsg()
    $READ2 = GUICtrlRead($CHECK)
    
    If $MSG = $DONE Then
        If $READ2 = $GUI_CHECKED Then
            $II = MsgBox(262145, "", "checked")
        ElseIf $READ2 = $GUI_UNCHECKED Then
            $II = MsgBox(262145, "", "unchecked")
        EndIf
    EndIf
    If $MSG = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Link to comment
Share on other sites

Not perfect but it is a start

#include <GUIConstants.au3>
GUICreate("")
$CHECK = GUICtrlCreateCheckbox(" CHECKBOX", 10, 10, 120, 20)
$CHECK1 = GUICtrlCreateCheckbox(" CHECKBOX1", 10, 30, 120, 20)
$CHECK2 = GUICtrlCreateCheckbox(" CHECKBOX2", 10, 50, 120, 20)
$CHECK3 = GUICtrlCreateCheckbox(" CHECKBOX3", 10, 70, 120, 20)

$DONE = GUICtrlCreateButton("done", 150, 40, 60, 25)
GUISetState()
While 1
    $MSG = GUIGetMsg()
    $READ2 = GUICtrlRead($CHECK)
    $READ3 = GUICtrlRead($CHECK1)
    $READ4 = GUICtrlRead($CHECK2)
    $READ5 = GUICtrlRead($CHECK3)
  
    If $MSG = $DONE Then
        If $READ2 = $GUI_CHECKED Then
            $II = MsgBox(262145, "", "Checkbox checked")
        ElseIf $READ3 = $GUI_CHECKED Then
            $II1 = MsgBox(262145, "", "Checkbox1 checked")
        ElseIf $READ4 = $GUI_CHECKED Then
            $II2 = MsgBox(262145, "", "Checkbox2 checked")
        ElseIf $READ5 = $GUI_CHECKED Then
            $II3 = MsgBox(262145, "", "Checkbox3 checked")
        EndIf
    EndIf
    If $MSG = $GUI_EVENT_CLOSE Then ExitLoop
WEnd


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Thanks, but how can I let the second program wait till the first is finished? Because if I check CHECKBOX and CHECKBOX 2 then only CHECKBOX will show something.

Not perfect but it is a start

#include <GUIConstants.au3>
GUICreate("")
$CHECK = GUICtrlCreateCheckbox(" CHECKBOX", 10, 10, 120, 20)
$CHECK1 = GUICtrlCreateCheckbox(" CHECKBOX1", 10, 30, 120, 20)
$CHECK2 = GUICtrlCreateCheckbox(" CHECKBOX2", 10, 50, 120, 20)
$CHECK3 = GUICtrlCreateCheckbox(" CHECKBOX3", 10, 70, 120, 20)

$DONE = GUICtrlCreateButton("done", 150, 40, 60, 25)
GUISetState()
While 1
    $MSG = GUIGetMsg()
    $READ2 = GUICtrlRead($CHECK)
    $READ3 = GUICtrlRead($CHECK1)
    $READ4 = GUICtrlRead($CHECK2)
    $READ5 = GUICtrlRead($CHECK3)
  
    If $MSG = $DONE Then
        If $READ2 = $GUI_CHECKED Then
            $II = MsgBox(262145, "", "Checkbox checked")
        ElseIf $READ3 = $GUI_CHECKED Then
            $II1 = MsgBox(262145, "", "Checkbox1 checked")
        ElseIf $READ4 = $GUI_CHECKED Then
            $II2 = MsgBox(262145, "", "Checkbox2 checked")
        ElseIf $READ5 = $GUI_CHECKED Then
            $II3 = MsgBox(262145, "", "Checkbox3 checked")
        EndIf
    EndIf
    If $MSG = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Edited by PcExpert
Link to comment
Share on other sites

  • Moderators

Ok, 1. You really need to do some research. BigDod found these by doing just that.

2. What is your main focus here? Do you want to read the checkboxes to see if they are checked?

All you have here are MsgBox examples, absolutely no example of your own.

If you want to read if each are checked, Don't use ElseIf just use If/EndIf. If you want to use Run() and Wait until one program has finished, use RunWait().

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I want to select some programs to run then click a button and the the first program starts, when the first program is finished the second starts. Where do I have to search for if I want to Find what BigDod has found

Edited by PcExpert
Link to comment
Share on other sites

  • Moderators

By using the Search and typing in keywords your looking for and using the + between them.

I already told you how to do this really:

If GUICtrlRead($Box1) = 1 Then RunWait('Some.exe')
If Not ProcessExists('Some.exe') And GUICtrlRead($Box2) = 1 Then RunWait('SomeOther.exe')
Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Where must I place it in this code?

CODE:

#include <GUIConstants.au3>

GUICreate("")

$CHECK = GUICtrlCreateCheckbox(" CHECKBOX", 10, 10, 120, 20)

$CHECK1 = GUICtrlCreateCheckbox(" CHECKBOX1", 10, 30, 120, 20)

$CHECK2 = GUICtrlCreateCheckbox(" CHECKBOX2", 10, 50, 120, 20)

$CHECK3 = GUICtrlCreateCheckbox(" CHECKBOX3", 10, 70, 120, 20)

$DONE = GUICtrlCreateButton("done", 150, 40, 60, 25)

GUISetState()

While 1

$MSG = GUIGetMsg()

$READ2 = GUICtrlRead($CHECK)

$READ3 = GUICtrlRead($CHECK1)

$READ4 = GUICtrlRead($CHECK2)

$READ5 = GUICtrlRead($CHECK3)

If $MSG = $DONE Then

If $READ2 = $GUI_CHECKED Then

$II = MsgBox(262145, "", "Checkbox checked")

ElseIf $READ3 = $GUI_CHECKED Then

$II1 = MsgBox(262145, "", "Checkbox1 checked")

ElseIf $READ4 = $GUI_CHECKED Then

$II2 = MsgBox(262145, "", "Checkbox2 checked")

ElseIf $READ5 = $GUI_CHECKED Then

$II3 = MsgBox(262145, "", "Checkbox3 checked")

EndIf

EndIf

If $MSG = $GUI_EVENT_CLOSE Then ExitLoop

WEnd

Edited by PcExpert
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...