Quinch Posted December 31, 2007 Share Posted December 31, 2007 (edited) There's probably a simple way to do this, but I can't seem to find it; I'm trying to find a way to quickly insert a series of values into a two-dimensional array. I know I can do this when I'm initially declaring the array, but I will need to do that long after the array has been declared. An example would be; Dim $Actors[10][9] {stuff happens, and I now have some of the variables I'll need to input into the array, and I want to insert nine values into the first row} HypotheticalInsertIntoArrayFunction($Actors[0], 1, 2, 3, 4, 5, 6, 7, 8, 9) Regards, Quinch EDIT: A quick clarification, I know I can modify individual values with $var[0][0] = "bleh", or setting up a function with a For/Next loop, but it seems as though it would seriously slow down the script. Edited December 31, 2007 by Quinch Link to comment Share on other sites More sharing options...
searchresult Posted December 31, 2007 Share Posted December 31, 2007 (edited) you could use for loop to do that EDIT: Sorry haven't seen you already wrote that. But it is still the best way to do it Edited December 31, 2007 by searchresult Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 31, 2007 Share Posted December 31, 2007 There's probably a simple way to do this, but I can't seem to find it; I'm trying to find a way to quickly insert a series of values into a two-dimensional array. I know I can do this when I'm initially declaring the array, but I will need to do that long after the array has been declared. An example would be; Dim $Actors[10][9] {stuff happens, and I now have some of the variables I'll need to input into the array, and I want to insert nine values into the first row} HypotheticalInsertIntoArrayFunction($Actors[0], 1, 2, 3, 4, 5, 6, 7, 8, 9) Regards, Quinch EDIT: A quick clarification, I know I can modify individual values with $var[0][0] = "bleh", or setting up a function with a For/Next loop, but it seems as though it would seriously slow down the script. Some For/Next loops would be the ONLY way to do this, but 10x9 array only has 90 elements and can be completely re-written in a few microseconds. Unless your real array is MUCH bigger, time won't be a significant factor. Also, you did say "insert" not "overwrite", so you would first have to change the size of the array without destroying data, using REDIM, before moving/adding data. Read up on REDIM in the help file. 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...
Quinch Posted January 2, 2008 Author Share Posted January 2, 2008 Some For/Next loops would be the ONLY way to do this, but 10x9 array only has 90 elements and can be completely re-written in a few microseconds. Unless your real array is MUCH bigger, time won't be a significant factor. Also, you did say "insert" not "overwrite", so you would first have to change the size of the array without destroying data, using REDIM, before moving/adding data.Read up on REDIM in the help file. Yeah, odds are the size of the dimensions might be in the deep hundreds, so time might become an issue {mostly due to lots of testing and retesting, but I can test with smaller arrays}. Also, yeah, originally it's insert since the array will be created blank {thus, values would need to be "inserted" into the array}, but overwrite/modify would have been a less misleading term. Anyhow, thanks for the help. Link to comment Share on other sites More sharing options...
randallc Posted January 2, 2008 Share Posted January 2, 2008 Hi, If you need faster for huge inserts, , use vbscript as in "Array2D.au3"as in my link in signature. Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW 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