Mag91 Posted July 12, 2017 Share Posted July 12, 2017 Hey guys, im not very good in AutoIT. I only made Little scripts like MouseClick, MouseMove(...). Now i have a little Question. I Build a GUI with 3 Checkboxes. When i check the Box 1 and hit the Start-button it shoud open the Noepad and write the letter A When i check the Box 1 & 2 and hit the Start-button it shoud open the Noepad and write the letters AB When i check the Box 1 - 3 and hit the Start-button it shoud open the Noepad and write the letters ABC How can i do that? THANKS! Quote #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 237, 142, 230, 134) $Button1 = GUICtrlCreateButton("Start", 16, 96, 201, 33) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 16, 193, 25) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 40, 193, 25) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 64, 177, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 Run("notepad.exe") Local $hWnd = WinWait("Untitled - Notepad", "", 2) WinMove($hWnd, "", 1177, 0, 743, 1040) ;===IF CHECKBOX1 IS CHECKED THEN SEND ("A") ;===IF CHECKBOX1 AND CHECKBOX2 ARE CHECKED THEN ("AB") ;===IF CHECKBOX1 - CHECKBOX3 ARE CHECKED THEN SEND ("ABC") ;===IF CHECKBOX2 IS CHECKED THEN SEND ("B") ;===IF CHECKBOX2 AND CHECKBOX3 ARE CHECKED THEN ("BC") ;===IF CHECKBOX3 IS CHECKED THEN SEND ("C") ;===IF CHECKBOX1 AND CHECKBOX3 ARE CHECKED THEN ("AC") EndSwitch WEnd Link to comment Share on other sites More sharing options...
Neutro Posted July 12, 2017 Share Posted July 12, 2017 (edited) Hello Mag91 and welcome to the AutoIT forums You can use GUICtrlRead to check if a checkbox is checked or not. Here is the related code: #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 237, 142, 230, 134) $Button1 = GUICtrlCreateButton("Start", 16, 96, 201, 33) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 16, 193, 25) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 40, 193, 25) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 64, 177, 33) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Run("notepad.exe") Local $hWnd = WinWait("[CLASS:Notepad]", "", 2) WinMove($hWnd, "", 1177, 0, 743, 1040) if GUICtrlRead($Checkbox1) = $GUI_CHECKED then send("A") if GUICtrlRead($Checkbox2) = $GUI_CHECKED then send("B") if GUICtrlRead($Checkbox3) = $GUI_CHECKED then send("C") EndSwitch WEnd Enjoy Edited July 12, 2017 by Neutro Mag91 1 Identify active network connections and change DNS server - Easily export Windows network settings Clean temporary files from Windows users profiles directories - List Active Directory Groups members Export content of an Outlook mailbox to a PST file - File patch manager - IRC chat connect example Thanks again for your help Water! Link to comment Share on other sites More sharing options...
Mag91 Posted July 13, 2017 Author Share Posted July 13, 2017 Thank you very much! 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