Skeletor Posted September 21, 2021 Posted September 21, 2021 Hi All, I have a problem. Can you return a value from an _ArraySearch? Below is from the help file. Basically, is it possible to get the value in the next column which is #33??? #include <Array.au3> #include <MsgBoxConstants.au3> Local $aArray[6][4] For $i = 0 To 5 For $j = 0 To 3 $aArray[$i][$j] = "#" & $i & $j Next Next _ArrayDisplay($aArray, "Looking for '#32'", Default, 8) Local $list ; Search by column (looking in col 2) Local $iIndex = _ArraySearch($aArray, "#32", 0, 0, 0, 0, 1, -1) MsgBox($MB_SYSTEMMODAL, "Found '#32'", "Column 2 on Row " & $iIndex) Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
Skeletor Posted September 21, 2021 Author Posted September 21, 2021 So I found a method of doing this and will leave this post open, because there maybe a better way of doing this. #include <Array.au3> #include <MsgBoxConstants.au3> Local $aArray[6][4] For $i = 0 To 5 For $j = 0 To 3 $aArray[$i][$j] = "#" & $i & $j Next Next _ArrayDisplay($aArray, "Looking for '#32'", Default, 8) Local $list ; Search by column (looking in col 2) Local $iRow = _ArraySearch($aArray, "#32", 0, 0, 0, 0, 1, -1, False) ; Search per row Local $iColumn = _ArraySearch($aArray, "#32", 0, 0, 0, 0, 1, -1, True) ; Search per Column MsgBox($MB_SYSTEMMODAL, "Found '#32'", "Column 2 and the value is " & $aArray[$iRow][$iColumn]) Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
Nine Posted September 21, 2021 Posted September 21, 2021 No need to search the whole array after first search : #include <Array.au3> #include <MsgBoxConstants.au3> Local $aArray[6][4] For $i = 0 To 5 For $j = 0 To 3 $aArray[$i][$j] = "#" & $i & $j Next Next _ArrayDisplay($aArray, "Looking for '#32'", Default, 8) Local $iLine = _ArraySearch($aArray, "#32") Local $iCol = _ArraySearch($aArray, "#32", 0, 0, 0, 0, 1, $iLine, True) MsgBox($MB_SYSTEMMODAL, "Found '#32'", $iLine & "/" & $iCol) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy
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