BrianAZ Posted July 6, 2008 Posted July 6, 2008 What I'm looking to do is throw together a simple GUI with checkboxes (say 7 checkboxes) where if one was checked it would launch an application. I've figured out how to have buttons launch apps but not as of yet with checkboxes.
Valuater Posted July 6, 2008 Posted July 6, 2008 Post your code, just show us what you have so far 8)
Valuater Posted July 6, 2008 Posted July 6, 2008 I found one through a simple search ( at the topt right of this screen ) #include <GUIConstants.au3> GUICreate("Program Runner") GUICtrlCreateLabel("Select the program.", 10, 10) $P1 = GUICtrlCreateRadio("Notepad", 10, 40, 80, 30) $P2 = GUICtrlCreateRadio("Explorer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($P1, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($P1) Then Run("Notepad.exe") If _IsChecked($P2) Then Run("Explorer.exe") EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8)
BrianAZ Posted July 6, 2008 Author Posted July 6, 2008 Post your code, just show us what you have so far8)Actually i think i just figured it out#include <GUIConstants.au3>GUICreate("") $checkCN = GUICtrlCreateCheckbox("App1", 10, 10, 120, 20)$checkCN1 = GUICtrlCreateCheckbox("App2", 10, 40, 120, 20)GUISetState() ; Run the GUI until the dialog is closedWhile 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $checkCN Then $cstate = BitAND(GUICtrlRead($checkCN), $GUI_CHECKED) If $cstate = $GUI_CHECKED Then ShellExecuteWait("notepad.exe") EndIf If $msg = $checkCN1 Then $cstate = BitAND(GUICtrlRead($checkCN1), $GUI_CHECKED) If $cstate = $GUI_CHECKED Then ShellExecuteWait("cmd.exe") EndIfWEndalthough is there a way to make app2 wait til app1 is finished before kicking off?/cmd & notepad is just what i'm playing with for the moment to test, but in the end it will be used to kick off installs of apps
BrianAZ Posted July 6, 2008 Author Posted July 6, 2008 I found one through a simple search ( at the topt right of this screen ) #include <GUIConstants.au3> GUICreate("Program Runner") GUICtrlCreateLabel("Select the program.", 10, 10) $P1 = GUICtrlCreateRadio("Notepad", 10, 40, 80, 30) $P2 = GUICtrlCreateRadio("Explorer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($P1, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($P1) Then Run("Notepad.exe") If _IsChecked($P2) Then Run("Explorer.exe") EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8) That works wonders actually
BrianAZ Posted July 6, 2008 Author Posted July 6, 2008 NPWelcome to the Autoit Forums8)oh one other question.....if i were to need to run a app and then have it patched, is that possible to do with just using one checkbox?two run statements for one?
Valuater Posted July 6, 2008 Posted July 6, 2008 #include <GUIConstants.au3> GUICreate("Program Runner") GUICtrlCreateLabel("Select the program.", 10, 10) $P1 = GUICtrlCreateRadio("Notepad", 10, 40, 80, 30) $P2 = GUICtrlCreateRadio("Explorer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($P1, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($P1) Then RunWait("Notepad.exe") RunWait("Explorer.exe") ; do what ever you want EndIf If _IsChecked($P2) Then RunWait("Explorer.exe") EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8)
BrianAZ Posted July 6, 2008 Author Posted July 6, 2008 #include <GUIConstants.au3> GUICreate("Program Runner") GUICtrlCreateLabel("Select the program.", 10, 10) $P1 = GUICtrlCreateRadio("Notepad", 10, 40, 80, 30) $P2 = GUICtrlCreateRadio("Explorer", 10, 70, 80, 30) $button = GUICtrlCreateButton("OK", 10, 120, 30) GUICtrlSetState($P1, $GUI_CHECKED) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $button If _IsChecked($P1) Then RunWait("Notepad.exe") RunWait("Explorer.exe") ; do what ever you want EndIf If _IsChecked($P2) Then RunWait("Explorer.exe") EndSelect WEnd Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked 8) Thanks so much!
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