Showtime2kX Posted September 6, 2012 Share Posted September 6, 2012 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): expandcollapse popup#include <GUIConstantsEx.au3> $ConnectionTest = "ConnectionTest.exe" $InstallOnline = "Install (Online).exe" $DefragglerCheckBox = GUICtrlCreateCheckbox("Defraggler", 300, 300, 100, 30) $Defraggler = "Defraggler.exe" _Main() 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 $STATE = "CHECK" Else $STATE = "UNCHECK" EndIf If GUICtrlRead($DefragglerCheckBox) = 1 Then Run($Defraggler) EndIf $cancelbutton = GUICtrlCreateButton("Cancel", 150, 350, 70, 20) GUISetState() GUICtrlCreatePic("logo.jpg", 0, 0, 400, 200) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton ExitLoop Case $msg = $fileitem $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)") If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu) Case $msg = $exititem ExitLoop Case $msg = $InstallOnlineButton Run($InstallOnline) Case $msg = $ConnectionTestButton Run($ConnectionTest) Case $msg = $aboutitem MsgBox(0, "About", "Matthew's AutoWork v1.0") EndSelect WEnd GUIDelete() Exit 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! Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2012 Share Posted September 6, 2012 I may be missing something here, but that GUI only seems to have one checkbox. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Showtime2kX Posted September 6, 2012 Author Share Posted September 6, 2012 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. Link to comment Share on other sites More sharing options...
JohnOne Posted September 6, 2012 Share Posted September 6, 2012 (edited) #include <GUIConstantsEx.au3> Example() 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 WEnd If GUICtrlRead($n) = $GUI_CHECKED Then MsgBox(0,0,"Checked") Else MsgBox(0,0,"Unchecked") EndIf EndFunc ;==>Example Edited September 6, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now