barbossa Posted April 19, 2013 Share Posted April 19, 2013 Hi! I was messing around with AutoIT, and found I can't initialize a 5D array. I re-checked the square brackets countless times, but AutoIT keeps returning "ERROR: wrong nesting in initializer". 4D arrays work fine. Here is the example: Local $arTestOk[2][2][2][2] = [[[[0,0],[0,0]],[[0,0],[0,0]]],[[[0,0],[0,0]],[[0,0],[0,0]]]] Local $arTestBad[2][2][2][2][2] = [[[[[0,0],[0,0]],[[0,0],[0,0]]],[[[0,0],[0,0]],[[0,0],[0,0]]]],[[[[0,0],[0,0]],[[0,0],[0,0]]],[[[0,0],[0,0]],[[0,0],[0,0]]]]] Is this a bug with AutoIT? Link to comment Share on other sites More sharing options...
water Posted April 19, 2013 Share Posted April 19, 2013 According to the documentation the maximum number of subscripts (dimensions) for an array is 64. So there must be something wrong with the brackets. 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...
barbossa Posted April 19, 2013 Author Share Posted April 19, 2013 That is the problem: the brackets ARE correct. Try running this: Dim $arTest[1][1][1][1][1] = [[[[[1]]]]] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 19, 2013 Moderators Share Posted April 19, 2013 barbossa, Before I spend any time on this problem - does it have a real-world application or are you just playing about? 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...
UEZ Posted April 19, 2013 Share Posted April 19, 2013 Beside that it is true that the brackets seems to be ok, how do you want to handle a 5D array? Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
BrewManNH Posted April 19, 2013 Share Posted April 19, 2013 Just letting you know, the brackets are probably fine, but you don't have enough numbers for a 5D array, you've only got sets of 0's, that's fine for a 4D array, but you're missing the 5th dimension. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
barbossa Posted April 19, 2013 Author Share Posted April 19, 2013 As I said in the first post, I was just playing around the possibility, I don't think it would have any practical application, and would definitely be horrendous to maintain. BrewManNH, look at the 1-sized example I posted after. It has 5 dimensions, and holds only one value (the number of values would be 1^5 = 1). The first example has 32 zeros, filling the entire array (2^5 = 32). Link to comment Share on other sites More sharing options...
jdelaney Posted April 19, 2013 Share Posted April 19, 2013 (edited) Looks like you will need to do 4d arrays, nested with 2d arrays edit, make that 1d arrays as the nested...hard to conceptualize Local $arraySub[2] = [0, 1] Local $arraySub2[2] = [2, 3] Local $array[2][2][2][2] = [[[[$arraySub,$arraySub2],[$arraySub,$arraySub2]],[[$arraySub,$arraySub2],[$arraySub,$arraySub2]]],[[[$arraySub,$arraySub2],[$arraySub,$arraySub2]],[[$arraySub,$arraySub2],[$arraySub,$arraySub2]]]] For $i = 0 To UBound($array) - 1 For $j = 0 To UBound($array, 2) - 1 For $k = 0 To UBound($array, 3) - 1 For $l = 0 To UBound($array, 4) - 1 $tempArray = $array[$i][$j][$k][$l] For $m = 0 To UBound($tempArray) - 1 ConsoleWrite("$array[" & $i & "][" & $j & "][" & $k & "][" & $l & "].[" & $m & "] = " & $tempArray[$m] & @CRLF) Next Next Next Next Next output: $array[0][0][0][0].[0] = 0 $array[0][0][0][0].[1] = 1 $array[0][0][0][1].[0] = 2 $array[0][0][0][1].[1] = 3 $array[0][0][1][0].[0] = 0 $array[0][0][1][0].[1] = 1 $array[0][0][1][1].[0] = 2 $array[0][0][1][1].[1] = 3 $array[0][1][0][0].[0] = 0 $array[0][1][0][0].[1] = 1 $array[0][1][0][1].[0] = 2 $array[0][1][0][1].[1] = 3 $array[0][1][1][0].[0] = 0 $array[0][1][1][0].[1] = 1 $array[0][1][1][1].[0] = 2 $array[0][1][1][1].[1] = 3 $array[1][0][0][0].[0] = 0 $array[1][0][0][0].[1] = 1 $array[1][0][0][1].[0] = 2 $array[1][0][0][1].[1] = 3 $array[1][0][1][0].[0] = 0 $array[1][0][1][0].[1] = 1 $array[1][0][1][1].[0] = 2 $array[1][0][1][1].[1] = 3 $array[1][1][0][0].[0] = 0 $array[1][1][0][0].[1] = 1 $array[1][1][0][1].[0] = 2 $array[1][1][0][1].[1] = 3 $array[1][1][1][0].[0] = 0 $array[1][1][1][0].[1] = 1 $array[1][1][1][1].[0] = 2 $array[1][1][1][1].[1] = 3 last modification...displaying the full fill Edited April 19, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Tekk Posted April 19, 2013 Share Posted April 19, 2013 AU3Check problem? It executes correct if you launch ouside of SciTE. Local $arTestBad[2][2][2][2][2] = [[[[[0,0],[0,0]],[[0,0],[0,0]]],[[[0,0],[0,0]],[[0,0],[0,0]]]],[[[[0,0],[0,0]],[[0,0],[0,0]]],[[[0,0],[0,0]],[[0,0],[0,0]]]]] $arTestBad[0][1][0][0][1] = Random(0, 100, 1) MsgBox(0x40000, '5D Array', '$arTestBad[0][1][0][0][1] = ' & $arTestBad[0][1][0][0][1]) Link to comment Share on other sites More sharing options...
BrewManNH Posted April 19, 2013 Share Posted April 19, 2013 I can't even imagine the use for a 5D array, but it's an interesting mind bender to get my head around the bracket and comma placements. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
barbossa Posted April 19, 2013 Author Share Posted April 19, 2013 Tekk, probably that, tested it too and the compiled .exe worked fine... jdelany, well done! Link to comment Share on other sites More sharing options...
jchd Posted April 19, 2013 Share Posted April 19, 2013 (edited) I just checked and AutoIt will work correctly with 10D arrays and more, unless Au3Check is invoked and the explicitely initialized. So this is a an Au3Check bug. In fact that post drew my attention on a point that escaped me until today, and probably devs themselves. The doc says the maximum dimension of an array is 64 but in fact the actual maximum "non nonsense" dimension is much less: Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] is a valid 23D array declaration but adding one more dimension result in hitting another limit: the maximum size of an array: "C:UsersjcDocumentsAutoMATTestNestedFor.au3" (7) : ==> Array maximum size exceeded.: Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2] Local $arTestBad[2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][2][^ ERROR Hence the maximum practical dimension of an array is 24, well, unless you use dummy dimensions like [1][1]... which don't bring you anything useful. I'm openning two distinct trac tickets on these points. As a [mathematically inclined] sidenote, a 24D object is enough to represent the Leech lattice, which makes this singular object appear once more in an area where it was not expected. EDIT: I checked that 64 dimensions are actually the hard limit, albeit useless: Local $arTestGood[1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1][1] works but is likely to use L.I.S.P. (Lots of Insipide Square Parenthesis) uselessly! Edited April 19, 2013 by jchd czardas 1 This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) 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