Nomisdk Posted December 7, 2014 Share Posted December 7, 2014 Hi I have the following code. How do i make, so it only returns the rows with A? #include <Array.au3> Local $aArray[6][2] = [[1, "A"],[2, "B"],[3, "C"],[4, "A"],[5, "B"],[6, "C"]] _ArrayDisplay($aArray, "2D array") ; Display the current array. Link to comment Share on other sites More sharing options...
JohnOne Posted December 7, 2014 Share Posted December 7, 2014 "it"? What do you mean by "it only returns"? 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...
water Posted December 7, 2014 Share Posted December 7, 2014 Loop through the array and only select those rows where the 2nd element contains "A". Easy, right My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted December 7, 2014 Share Posted December 7, 2014 BTW: To post code please use the AutoIt code tag (the blue "A") in the editor. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Nomisdk Posted December 7, 2014 Author Share Posted December 7, 2014 Hi Water Can you make me a example of how to do it? Link to comment Share on other sites More sharing options...
water Posted December 7, 2014 Share Posted December 7, 2014 (edited) Untested.#include <Array.au3> Local $aArrayIn[6][2] = [[1, "A"],[2, "B"],[3, "C"],[4, "A"],[5, "B"],[6, "C"]] Local $aArrayOut[6][2] Local $iIndexOut = 0 For $iIndexIn = 0 to UBound($aArrayIn) - 1 If $aArrayIn[$iIndexIn][1] = "A" Then $aArrayOut[$iIndexOut][0] = $aArrayIn[$iIndexIn][0] $aArrayOut[$iIndexOut][1] = $aArrayIn[$iIndexIn][1} $iIndexOut = $iIndexOut + 1 EndIf Next ReDim $aArrayOut[$iIndexOut][2] _ArrayDisplay($aArrayOut, "2D array") Edited December 7, 2014 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mikell Posted December 7, 2014 Share Posted December 7, 2014 Untested. After fixing the typo, works nice Link to comment Share on other sites More sharing options...
water Posted December 7, 2014 Share Posted December 7, 2014 Typo, what typo My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Spider001 Posted December 7, 2014 Share Posted December 7, 2014 (edited) $aArrayOut[$iIndexOut][1] = $aArrayIn[$iIndexIn][1} => ] Edited December 7, 2014 by Spider001 Link to comment Share on other sites More sharing options...
mikell Posted December 7, 2014 Share Posted December 7, 2014 (edited) Well, thanks Spider001 I was about to reinstall AutoIt, hoping that I would not have to format c: Edited December 7, 2014 by mikell kylomas 1 Link to comment Share on other sites More sharing options...
water Posted December 7, 2014 Share Posted December 7, 2014 (edited) Ahhhh, I see Edited December 7, 2014 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Spider001 Posted December 7, 2014 Share Posted December 7, 2014 Well, thanks Spider001 I was about reinstalling AutoIt, hoping that I would not have to format c: Well i think you need to do a format, this is so strange i think you have a virus or so that change char 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