bremen Posted July 13, 2015 Share Posted July 13, 2015 (edited) I have a script that updates information in a given combo box. Before that combo box can be edited a checkbox must be flagged. I run into a problem if the check box is already flagged. Is there a way for auto it to see if a checkbox is flagged then if it is not flag it and continue with the script or if it already flagged skip that step and continue with the script? Edited July 16, 2015 by bremen Solved Link to comment Share on other sites More sharing options...
JohnOne Posted July 13, 2015 Share Posted July 13, 2015 Explain what you mean by "flagged" 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...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 A check in the box. Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 (edited) Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsCheckedThat was just in Help file. Look first in Helpfile^^.How to use:Case $idCheckbox If _IsChecked($idCheckbox) Then MsgBox($MB_SYSTEMMODAL, "", "The checkbox is checked.", 0, $hGUI) Else MsgBox($MB_SYSTEMMODAL, "", "The checkbox is not checked.", 0, $hGUI) EndIfCase $13 If _IsChecked($13) Then _GUICtrlEdit_AppendText($Console,"Checked" & @CRLF) ElseIf Not _IsChecked($13) Then _GUICtrlEdit_AppendText($Console,"Unchecked" & @CRLF) EndIf Edited July 13, 2015 by RaiNote C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 I hope that was what you wanted. ^-^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 I did try looking in the help file, however, I could not find what you posted. What was your search criteria? Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 It is named "Function GUICtrlCreateCheckbox" or just search for Checkbox it should be the first one^^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 Ah hah.... I searched "Check box" and not "checkbox" Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 But now everything works, right? C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 expandcollapse popup#include <Array.au3> #include <Excel.au3> #include <WinAPI.au3> ; opens excel workbook ;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME Local $oExcel = _ExcelBookOpen("C:\File Path \File.xls") ; reads data into array $aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2, True) ; closes the excel workbook _ExcelBookClose($oExcel) ; displays the array that was read. _ArrayDisplay($aArray1) ; counts the number of rows in the array $rows = UBound($aArray1) -1 for $c = 1 to $rows WinActivate("ACCESS - [Stock") WinWaitActive("ACCESS - [Stock") ControlClick("ACCESS - [Stock", "Part number:", 905, "left") controlsend("ACCESS - [Stock", "Part number:", 905, $aArray1[$c][0]) send("{TAB}") Sleep(700) ControlCommand("ACCESS - [Stock","Part number","SysTabControl325","TabRight","") Case $idCheckbox If _IsChecked($idCheckbox) Then sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) send("{TAB}") Else sleep(700) ControlClick("ACCESS - [Stock", "Enable code", 2288, "left") sleep(700) sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) send("{TAB}") EndIf ControlClick("ACCESS - [Stock", "Apply", 12321, "left") Sleep(700) Send("{ALT}f"&"n") nextHere is my script I am getting syntax errors for my $c = 1 to $rows and for the case $idcheckbox. I have search for the case $idcheckbox and got no results returned. Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 Some Functions undefined ^^ butexpandcollapse popup#include <Array.au3> #include <Excel.au3> #include <WinAPI.au3> ; opens excel workbook ;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME Local $oExcel = _ExcelBookOpen("C:\File Path \File.xls") ; reads data into array $aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2, True) ; closes the excel workbook _ExcelBookClose($oExcel) ; displays the array that was read. _ArrayDisplay($aArray1) ; counts the number of rows in the array $rows = UBound($aArray1) - 1 For $c = 1 To $rows WinActivate("ACCESS - [Stock") WinWaitActive("ACCESS - [Stock") ControlClick("ACCESS - [Stock", "Part number:", 905, "left") ControlSend("ACCESS - [Stock", "Part number:", 905, $aArray1[$c][0]) Send("{TAB}") Sleep(700) Next ControlCommand("ACCESS - [Stock", "Part number", "SysTabControl325", "TabRight", "") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $idCheckbox If _IsChecked($idCheckbox) Then Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") Else Sleep(700) ControlClick("ACCESS - [Stock", "Enable code", 2288, "left") Sleep(700) Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") EndIf ControlClick("ACCESS - [Stock", "Apply", 12321, "left") Sleep(700) Send("{ALT}f" & "n") EndSwitch WEnd Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsCheckedWithout GUI a bit complicated for me but that should work^^ without the Excel Funcs on my side(Haven't the Funcs)^^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 Some Functions undefined ^^ butexpandcollapse popup#include <Array.au3> #include <Excel.au3> #include <WinAPI.au3> ; opens excel workbook ;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME Local $oExcel = _ExcelBookOpen("C:\File Path \File.xls") ; reads data into array $aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2, True) ; closes the excel workbook _ExcelBookClose($oExcel) ; displays the array that was read. _ArrayDisplay($aArray1) ; counts the number of rows in the array $rows = UBound($aArray1) - 1 For $c = 1 To $rows WinActivate("ACCESS - [Stock") WinWaitActive("ACCESS - [Stock") ControlClick("ACCESS - [Stock", "Part number:", 905, "left") ControlSend("ACCESS - [Stock", "Part number:", 905, $aArray1[$c][0]) Send("{TAB}") Sleep(700) Next ControlCommand("ACCESS - [Stock", "Part number", "SysTabControl325", "TabRight", "") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $idCheckbox If _IsChecked($idCheckbox) Then Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") Else Sleep(700) ControlClick("ACCESS - [Stock", "Enable code", 2288, "left") Sleep(700) Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") EndIf ControlClick("ACCESS - [Stock", "Apply", 12321, "left") Sleep(700) Send("{ALT}f" & "n") EndSwitch WEnd Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsCheckedWithout GUI a bit complicated for me but that should work^^ without the Excel Funcs on my side(Haven't the Funcs)^^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 Some Functions undefined ^^ butexpandcollapse popup#include <Array.au3> #include <Excel.au3> #include <WinAPI.au3> ; opens excel workbook ;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME Local $oExcel = _ExcelBookOpen("C:\File Path \File.xls") ; reads data into array $aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2, True) ; closes the excel workbook _ExcelBookClose($oExcel) ; displays the array that was read. _ArrayDisplay($aArray1) ; counts the number of rows in the array $rows = UBound($aArray1) - 1 For $c = 1 To $rows WinActivate("ACCESS - [Stock") WinWaitActive("ACCESS - [Stock") ControlClick("ACCESS - [Stock", "Part number:", 905, "left") ControlSend("ACCESS - [Stock", "Part number:", 905, $aArray1[$c][0]) Send("{TAB}") Sleep(700) Next ControlCommand("ACCESS - [Stock", "Part number", "SysTabControl325", "TabRight", "") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $idCheckbox If _IsChecked($idCheckbox) Then Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") Else Sleep(700) ControlClick("ACCESS - [Stock", "Enable code", 2288, "left") Sleep(700) Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") EndIf ControlClick("ACCESS - [Stock", "Apply", 12321, "left") Sleep(700) Send("{ALT}f" & "n") EndSwitch WEnd Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsCheckedWithout GUI a bit complicated for me but that should work^^ without the Excel Funcs on my side(Haven't the Funcs)^^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 Where do I define the control id for the checkbox? Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 You need to create a GUI^^ Like that :expandcollapse popup#include <Array.au3> #include <Excel.au3> #include <WinAPI.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 117, 27, 192, 124) $ThisIsTheCheckBoxID = GUICtrlCreateCheckbox("ThisIsTheCheckBoxID", 0, 0, 97, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; opens excel workbook ;REST THE WORKBOOK FOR YOUR FILE PATH AND NAME Local $oExcel = _ExcelBookOpen("C:\File Path \File.xls") ; reads data into array $aArray1 = _ExcelReadSheetToArray($oExcel, 1, 1, 0, 2, True) ; closes the excel workbook _ExcelBookClose($oExcel) ; displays the array that was read. _ArrayDisplay($aArray1) ; counts the number of rows in the array $rows = UBound($aArray1) - 1 For $c = 1 To $rows WinActivate("ACCESS - [Stock") WinWaitActive("ACCESS - [Stock") ControlClick("ACCESS - [Stock", "Part number:", 905, "left") ControlSend("ACCESS - [Stock", "Part number:", 905, $aArray1[$c][0]) Send("{TAB}") Sleep(700) Next ControlCommand("ACCESS - [Stock", "Part number", "SysTabControl325", "TabRight", "") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $ThisIsTheCheckBoxID If _IsChecked($ThisIsTheCheckBoxID) Then Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") Else Sleep(700) ControlClick("ACCESS - [Stock", "Enable code", 2288, "left") Sleep(700) Sleep(700) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "ShowDropDown") ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "SelectString", $aArray1[$c][1]) ControlCommand("ACCESS - [Stock", "Code:", "ComboBox3", "HideDropDown") Sleep(700) Send("{TAB}") EndIf ControlClick("ACCESS - [Stock", "Apply", 12321, "left") Sleep(700) Send("{ALT}f" & "n") EndSwitch WEnd Func _IsChecked($idControlID) Return BitAND(GUICtrlRead($idControlID), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 (edited) So how u should see the ID of the Checkbox is just the $ThisIsTheCheckBoxIDYou could also Name it The ID is the same like the Variable-ID :3 Edited July 13, 2015 by RaiNote C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 13, 2015 Moderators Share Posted July 13, 2015 Bremen,Looking at the code you posted, and seeing you need to use ControlCommand to action the combo, I assume this checkbox is actually in an external GUI along with the combo. if this indeed the case then you will need to use the same command with the "IsChecked" parameter to see if the checkbox is clicked or not - you get the checkbox ControlID in the same way as you identified the combo CID.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 Perhaps i should clarify.... The program that this script will be interacting with has a control id of 2288 assigned to this particular checkbox. I am interacting with a GUI that is already created. Link to comment Share on other sites More sharing options...
RaiNote Posted July 13, 2015 Share Posted July 13, 2015 If you would post the GUI it would may a bit easier and faster to attach the code with GUI ^-^. But also without you would only have to change the Control ID's^^ C++/AutoIt/OpenGL Easy Coder I will be Kind to you and try to help you till what you want isn't against the Forum Rules~ Link to comment Share on other sites More sharing options...
bremen Posted July 13, 2015 Author Share Posted July 13, 2015 RaiNote.....I am using a software with its own GUI. I can not "attach the GUI". Melba23I am trying to find where in the help file this would be documented as I do not understand how to use the "ischecked" function. Can you please point me in the right direction? I have tried searching for " _IsChecked", "IsChecked", and "Checkbox" with no luck 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