danielgomez Posted May 22, 2017 Share Posted May 22, 2017 Hello, I am developing an experimental project since I am new in this language the program what you do is functions by checkboxes and you should activate the check box only if the program is started. I want the program to perform the check box only if the program is running. code: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Constants.au3> HotKeySet("{s}", "Start") HotKeySet("{e}", "stop") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MultiTool PRO", 217, 84, 192, 124) $calculator = GUICtrlCreateCheckbox("Calculator", 112, 16, 97, 17) $NotePad = GUICtrlCreateCheckbox("NotePad", 112, 48, 97, 17) $Group1 = GUICtrlCreateGroup("HotKeys", 8, 8, 89, 65) $Label1 = GUICtrlCreateLabel("S - Start", 32, 24, 42, 17) $Label2 = GUICtrlCreateLabel("E - Exit", 32, 48, 37, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() Switch $Form1 Case $calculator open_calc() Case $NotePad open_notepad() EndSwitch EndFunc ;==>Start Func open_calc() Run("calc.exe") EndFunc Func open_notepad() Run("notepad.exe") EndFunc Func stop() Exit EndFunc ;==>stop What is the problem in my code ? Active the e key does not work: C Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2017 Developers Share Posted May 22, 2017 I am not entirely sure what you are asking and you definition of your problem, but do know this looks wrong: Func Start() Switch $Form1 Case $calculator open_calc() Case $NotePad open_notepad() EndSwitch EndFunc ;==>Start What are you expecting the value of $form1, $calculator and $Notepad to be other than a Form and Control handle? Please try to define the steps to replicate your issue with the posted code and what you are expecting it to do. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
danielgomez Posted May 22, 2017 Author Share Posted May 22, 2017 33 minutes ago, Jos said: I am not entirely sure what you are asking and you definition of your problem, but do know this looks wrong: Func Start() Switch $Form1 Case $calculator open_calc() Case $NotePad open_notepad() EndSwitch EndFunc ;==>Start What are you expecting the value of $form1, $calculator and $Notepad to be other than a Form and Control handle? Please try to define the steps to replicate your issue with the posted code and what you are expecting it to do. Jos What is the solution, I'm noob in AutoIt :C Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2017 Developers Share Posted May 22, 2017 2 minutes ago, danielgomez said: What is the solution, I'm noob in AutoIt :C What is the question? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
danielgomez Posted May 22, 2017 Author Share Posted May 22, 2017 26 minutes ago, Jos said: What is the question? How do I make the checkbox function work when the program is activated? Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2017 Developers Share Posted May 22, 2017 You are not very descriptive ..are you? Open the helpfile and read the page about the GUICtrlCreateCheckbox(). There is an example there how to read its status. Give that a try and post back when you have more question, but use more elaborate description of how you want it to work! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
danielgomez Posted May 22, 2017 Author Share Posted May 22, 2017 28 minutes ago, Jos said: Usted no es muy descriptivo ..are usted? Abra el archivo de ayuda y leer la página sobre la GUICtrlCreateCheckbox (). Hay un ejemplo no cómo leer su estado. Inténtelo y después de vuelta cuando se tiene más pregunta, pero el uso más elaborada descripción de cómo desea que funcione! Jos I'm sorry XD I want the check boxes to work if they are enabled but only when I press S If you understand me ? Link to comment Share on other sites More sharing options...
anthonyjr2 Posted May 22, 2017 Share Posted May 22, 2017 Can you explain a little further? Do you want the program to run when you click the checkbox? Or the checkbox to be enabled only if the program is running? UHJvZmVzc2lvbmFsIENvbXB1dGVyZXI= Link to comment Share on other sites More sharing options...
Developers Jos Posted May 22, 2017 Developers Share Posted May 22, 2017 Ok ... this one time I will bite, but honestly already pointed you to the simple change to make in the helpfile: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Constants.au3> HotKeySet("{s}", "Start") HotKeySet("{e}", "stop") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MultiTool PRO", 217, 84, 192, 124) $calculator = GUICtrlCreateCheckbox("Calculator", 112, 16, 97, 17) $NotePad = GUICtrlCreateCheckbox("NotePad", 112, 48, 97, 17) $Group1 = GUICtrlCreateGroup("HotKeys", 8, 8, 89, 65) $Label1 = GUICtrlCreateLabel("S - Start", 32, 24, 42, 17) $Label2 = GUICtrlCreateLabel("E - Exit", 32, 48, 37, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() If _IsChecked($calculator) Then open_calc() If _IsChecked($NotePad) Then open_notepad() EndFunc ;==>Start Func open_calc() Run("calc.exe") EndFunc ;==>open_calc Func open_notepad() Run("notepad.exe") EndFunc ;==>open_notepad Func stop() Exit EndFunc ;==>stop Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
danielgomez Posted May 22, 2017 Author Share Posted May 22, 2017 1 hour ago, anthonyjr2 said: Can you explain a little further? Do you want the program to run when you click the checkbox? Or the checkbox to be enabled only if the program is running? Thanks but I solved the problem :3 Link to comment Share on other sites More sharing options...
danielgomez Posted May 22, 2017 Author Share Posted May 22, 2017 1 hour ago, Jos said: Ok ... this one time I will bite, but honestly already pointed you to the simple change to make in the helpfile: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <Constants.au3> HotKeySet("{s}", "Start") HotKeySet("{e}", "stop") #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("MultiTool PRO", 217, 84, 192, 124) $calculator = GUICtrlCreateCheckbox("Calculator", 112, 16, 97, 17) $NotePad = GUICtrlCreateCheckbox("NotePad", 112, 48, 97, 17) $Group1 = GUICtrlCreateGroup("HotKeys", 8, 8, 89, 65) $Label1 = GUICtrlCreateLabel("S - Start", 32, 24, 42, 17) $Label2 = GUICtrlCreateLabel("E - Exit", 32, 48, 37, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func Start() If _IsChecked($calculator) Then open_calc() If _IsChecked($NotePad) Then open_notepad() EndFunc ;==>Start Func open_calc() Run("calc.exe") EndFunc ;==>open_calc Func open_notepad() Run("notepad.exe") EndFunc ;==>open_notepad Func stop() Exit EndFunc ;==>stop Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked Jos Thanks that was the solution: 3 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