cypher175 Posted June 23, 2009 Share Posted June 23, 2009 is there any way to add values across a ROW to the end of an existing Multi-Dimensional array in a way like _ArrayAdd can do to a 1 dimensional array..?? or do you just have to specify each grid cell by making a variable for each one like: Dim $Grid[2][3] $Grid[0][0]="000" $Grid[0][1]="111" $Grid[0][2]="222" $Grid[1][0]="000" $Grid[1][1]="111" $Grid[1][2]="222" Link to comment Share on other sites More sharing options...
KaFu Posted June 23, 2009 Share Posted June 23, 2009 No standard UDF, but I guess there has to be something in the examples thread. I do it myself by Redim()ing the array and looping through values to set. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
cypher175 Posted June 23, 2009 Author Share Posted June 23, 2009 But the array I'm creating cant be set to a specific row number.. I need it to always have 5 Columns but the rows are going to fluctuate because I will be adding and removing rows every so often.. so I need a way to Add data across a new Row at the bottom of a Multi-Dimensional array and also a way to remove the whole "Row 0" out of the same Multi-Dimensional array.. Link to comment Share on other sites More sharing options...
KaFu Posted June 23, 2009 Share Posted June 23, 2009 Yeah, I do it by Redim()ing the array and looping , take a look at the array functions and you'll see that they do exactly that... so look into the examples for a custom UDF or do it this way. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
cypher175 Posted June 24, 2009 Author Share Posted June 24, 2009 what exactly do you mean by "Redim()ing the array and looping"..?? would you mind showing me an example of that please..?? Link to comment Share on other sites More sharing options...
rajeshontheweb Posted June 24, 2009 Share Posted June 24, 2009 ; help files ARE helpful just go through the info on ubound and redim here's an example of redimensioning arrays and adding information to it.. ; list allvisible windows #include <Array.au3> $var = WinList() Dim $list[1][1] For $i = 1 To $var[0][0] If $var[$i][0] <> "" And IsVisible($var[$i][1]) Then ReDim $list[UBound($list) + 1][2]; <----- if u need to redim the second dimension, check help file for redim and ubound. $list[UBound($list) - 1][0] = $var[$i][0] $list[UBound($list) - 1][1] = $var[$i][1] EndIf Next _ArrayDisplay($var) _ArrayDisplay($list) Func IsVisible($handle) If BitAND(WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc Started late is much better than having never started it!!!!Failure is another step towards success. I've been messing around with: Adding Entry to 'Hosts'File Information Lister (Logger)Yet Another AutoIT Error Handler Yet Another AutoIT Error Handler & Debugger Control your App's TaskBar Button YCurrency Ticker (Latest Release : 16 Apr 2009)_WinInetInternetCheckConnection UDF Symantec Definitions Lister UDF _GetLocalIPAddresses UDF UDF to get Special Folder Information WMI_NetworkAdapterConfiguration2Array WMI_CDRomDriveCapabilities _ScriptExists - Check if your au3 script is running!! Uninstaller UDF Get Version for your application (at script level or compiled stage) Uninstaller Pro - faster alternative to windows application removal applet Link to comment Share on other sites More sharing options...
cypher175 Posted June 24, 2009 Author Share Posted June 24, 2009 is it possible to store Arrays inside the cells of another Array at all..?? Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 24, 2009 Share Posted June 24, 2009 is there any way to add values across a ROW to the end of an existing Multi-Dimensional array in a way like _ArrayAdd can do to a 1 dimensional array..?? No standard UDF, but I did post a 2D version of an Array.au3 function, called __ArrayConcatenate(). Note the double underscore in the name. It will handle either 1D or 2D functions. The original post includes a demo script. expandcollapse popup; #FUNCTION# ===================================================================== ; Name...........: __ArrayConcatenate ; Description ...: Concatenate two 1D or 2D arrays ; Syntax.........: __ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource) ; Parameters ....: $avArrayTarget - The array to concatenate onto ; $avArraySource - The array to concatenate from - Must be 1D or 2D to match $avArrayTarget, ; and if 2D, then Ubound($avArraySource, 2) <= Ubound($avArrayTarget, 2). ; Return values .: Success - Index of last added item ; Failure - -1, sets @error to 1 and @extended per failure (see code below) ; Author ........: Ultima ; Modified.......: PsaltyDS - 1D/2D version, changed return value and @error/@extended to be consistent with __ArrayAdd() ; Remarks .......: ; Related .......: __ArrayAdd, _ArrayPush ; Link ..........; ; Example .......; Yes ; =============================================================================== Func __ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource) If Not IsArray($avArrayTarget) Then Return SetError(1, 1, -1); $avArrayTarget is not an array If Not IsArray($avArraySource) Then Return SetError(1, 2, -1); $avArraySource is not an array Local $iUBoundTarget0 = UBound($avArrayTarget, 0), $iUBoundSource0 = UBound($avArraySource, 0) If $iUBoundTarget0 <> $iUBoundSource0 Then Return SetError(1, 3, -1); 1D/2D dimensionality did not match If $iUBoundTarget0 > 2 Then Return SetError(1, 4, -1); At least one array was 3D or more Local $iUBoundTarget1 = UBound($avArrayTarget, 1), $iUBoundSource1 = UBound($avArraySource, 1) Local $iNewSize = $iUBoundTarget1 + $iUBoundSource1 If $iUBoundTarget0 = 1 Then ; 1D arrays ReDim $avArrayTarget[$iNewSize] For $i = 0 To $iUBoundSource1 - 1 $avArrayTarget[$iUBoundTarget1 + $i] = $avArraySource[$i] Next Else ; 2D arrays Local $iUBoundTarget2 = UBound($avArrayTarget, 2), $iUBoundSource2 = UBound($avArraySource, 2) If $iUBoundSource2 > $iUBoundTarget2 Then Return SetError(1, 5, -1); 2D boundry of source too large for target ReDim $avArrayTarget[$iNewSize][$iUBoundTarget2] For $r = 0 To $iUBoundSource1 - 1 For $c = 0 To $iUBoundSource2 - 1 $avArrayTarget[$iUBoundTarget1 + $r][$c] = $avArraySource[$r][$c] Next Next EndIf Return $iNewSize - 1 EndFunc;==>__ArrayConcatenate Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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