Sign in to follow this  
Followers 0

Selecting Programs with Checkbox

4 posts in this topic

Hey all,

So here is what I'm trying to accomplish: I'm working on a program to automate my PC repair business. I have the individual scripts finished, and am working on the GUI portion now. I am still testing how exactly I want it, but one idea I had was I would like to have several checkboxes along with a "Run" button (or similar) that will run the programs pertaining to the boxes that are checked.

Here is my current program (GUI portion):

#include <GUIConstantsEx.au3>
$ConnectionTest = "ConnectionTest.exe"
$InstallOnline = "Install (Online).exe"
$DefragglerCheckBox = GUICtrlCreateCheckbox("Defraggler", 300, 300, 100, 30)
$Defraggler = "Defraggler.exe"

Func _Main()
Local $filemenu, $fileitem, $recentfilesmenu, $separator1
Local $exititem, $helpmenu, $aboutitem, $okbutton, $cancelbutton
Local $msg, $file
#forceref $separator1
GUICreate("GUI menu", 400, 500)
$filemenu = GUICtrlCreateMenu("File")
$fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
$recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
$separator1 = GUICtrlCreateMenuItem("", $filemenu)
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
$helpmenu = GUICtrlCreateMenu("?")
$aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
$ConnectionTestButton = GUICtrlCreateButton("Connection Tests", 50, 250, 150, 20)
$InstallOnlineButton = GUICtrlCreateButton("Install (Online)", 200, 250, 150, 20)
$DefragglerCheckBox = GUICtrlCreateCheckbox("Defraggler", 300, 300, 100, 30)

If GUICtrlRead($DefragglerCheckBox) = 1 Then
If GUICtrlRead($DefragglerCheckBox) = 1 Then

$cancelbutton = GUICtrlCreateButton("Cancel", 150, 350, 70, 20)
GUICtrlCreatePic("logo.jpg", 0, 0, 400, 200)
While 1
$msg = GUIGetMsg()

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton
Case $msg = $fileitem
$file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)
Case $msg = $exititem
Case $msg = $InstallOnlineButton
Case $msg = $ConnectionTestButton

Case $msg = $aboutitem
MsgBox(0, "About", "Matthew's AutoWork v1.0")
EndFunc ;==>_Main

I was trying to accomplish this with the "Defraggler" portion. As mentioned, I'm not even close. I might get this eventually, but I would much rather prefer some assistance and figure this out sooner than I would on my own.

Thanks in advance!

Share this post

Link to post
Share on other sites

I may be missing something here, but that GUI only seems to have one checkbox.

The idea is to have someone give me an example. I was trying to get just a single checkbox to work on my own.

Share this post

Link to post
Share on other sites

#4 ·  Posted (edited)

#include <GUIConstantsEx.au3>


Func Example()
    Local $n, $msg

    GUICreate("My GUI (GetControlState)")
    $n = GUICtrlCreateCheckbox("checkbox", 10, 10)
    GUICtrlSetState(-1, 1) ; checked

    GUISetState() ; will display an empty dialog box

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()

        If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    If GUICtrlRead($n) = $GUI_CHECKED Then
EndFunc   ;==>Example

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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