Queener Posted December 19, 2016 Share Posted December 19, 2016 (edited) I have 14 fields and I was wondering is there an easier way to count the fields that contain Child? If guictrlread($textbox1) = "Child" then $xcountchild = $xcountchild + 1 endif etc... So those are my current codes, but is there an easier way to could? Edited December 19, 2016 by Queener Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
water Posted December 19, 2016 Share Posted December 19, 2016 How do you set this variables? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Queener Posted December 19, 2016 Author Share Posted December 19, 2016 $textbox1, $textbox2, etc... for textboxes $xcountchild is to call all variables that the textboxes contain the string child. Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
water Posted December 19, 2016 Share Posted December 19, 2016 I mean: Do they get set using a GUI? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Queener Posted December 19, 2016 Author Share Posted December 19, 2016 (edited) yes. I also fixed my code during reading the textbox lol I tried, but it's not working because I would think I needed to declare it as an object. $x = 0 For $x = 0 To 14 If guictrlread($InputName($x)) = "Child" Then $xchild = $xchild + $x EndIf Next MsgBox(0, "", $xchild) Edited December 19, 2016 by Queener Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
water Posted December 19, 2016 Share Posted December 19, 2016 Assign the IDs returned from GUICtrlCreate* to an array and then loop thorugh this array doing a GUICtrlRead one each ID. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
kylomas Posted December 19, 2016 Share Posted December 19, 2016 (edited) Queener, See if this makes sense... #include <StaticConstants.au3> #include <GuiConstantsEx.au3> Local $gui010 = GUICreate('Find ""Child""',200,500) Local $inputname[14] For $1 = 0 To 13 $inputname[$1] = GUICtrlCreateLabel('', 10, $1 * 30 + 10, 90, 20, $SS_SUNKEN) Next For $1 = 0 To Random(0, UBound($inputname) - 1, 1) GUICtrlSetData($inputname[$1], 'Child') Next GUISetState() While 1 Switch GUIGetMsg() Case $gui_event_close ExitLoop EndSwitch WEnd Local $xchild For $x = 0 To 13 If GUICtrlRead($inputname[$x]) = "Child" Then ; <--- you were using $inputname as a function, use it as an array $xchild += 1 EndIf Next MsgBox(0, "", $xchild) kylomas Edited December 19, 2016 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Queener Posted December 20, 2016 Author Share Posted December 20, 2016 (edited) Wow, exactly what I'm looking for... My 60 lines became less than 12 lines. LoL Thanks for the help. Much appreciated. Edited December 20, 2016 by Queener Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") 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