jimg Posted February 5, 2024 Posted February 5, 2024 Extrapolating what's in the help file, I would expect this to work, but is says "syntax error". local $var[5,5,7] $var[0,0] = [1,2,3,4,5,6,7] $var[0,1]= [7,6,5,4,3,2,1] etc. My $var array is loaded once, so I suppose I could read a file or something, but the above seemed so straightforward. BTW, this doesn't work either, which is a nearly direct quote from help: $local $days[7] $days = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"] but this does, so maybe my help file is out-of-date? local $days[7] = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
water Posted February 5, 2024 Posted February 5, 2024 (edited) You define $var as a 1D array but you specify 2 dimensions on your assignment statements. $local is wrong - remove the $ sign. Edited February 5, 2024 by water Updated to make my post correct 😃 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
Nine Posted February 5, 2024 Posted February 5, 2024 In fact, if you want to declare a 3D array you need to use : Local $var[5][5][7] If you want to assign a value to a specific cell, you need to use : $var[0][1][5] = "A value" If you want to instantiate a 3D array, you would need to use : Local $var[5][5][7] = [[[1,2,3,4,5,1,2], [6,7,8,9,0,1,2]]] ; partly instantiated Obviously, you are mixing how to declare an array and how to instantiate it. Please review help file and wiki to better understand how arrays are functioning in AutoIt. “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
jimg Posted February 5, 2024 Author Posted February 5, 2024 I clearly mistyped the $local example. I really hate to have a assignment string with 175 values. I guess I'll use a separate file for the data table.
water Posted February 5, 2024 Posted February 5, 2024 To transform a string into an Array please have a look at function StringSplit. 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
jimg Posted February 5, 2024 Author Posted February 5, 2024 Thanks. I've moved on to an external data file and stringsplit.
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