Login | |
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/17/2006 9:48:00 AM
|
|
 |
|
| |
dm_4ever
Posts: 2721
Score: 46
Joined: 6/29/2006
From: Orange County, California
Status: offline
|
Dim aProgList(1) ' you just need to add this and i think it will work like you want it to. aProgList(0) = "DRA, Directory and Resource Administrator, C:\Program Files\NetIQ\DRA\UserConsole.exe" aProgList(1) = "Remedy, Action Request System - Remedy User, C:\Program Files\AR System\User\aruser.exe" x = 0 For Each str In aProgList ReDim Preserve aExpProg(x) aExpProg(x) = Split(str,", ") x = x + 1 Next ' Attempt 1 For Each item In aExpProg WScript.Echo item(0) WScript.Echo item(1) WScript.Echo item(2) Next
|
|
| |
|
|
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/20/2006 1:47:42 AM
|
|
 |
|
| |
ginolard
Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
|
In my experience dynamic arrays just aren't worth it. Constantly Redimming an array uses more memory and is less performant than simply declaring an array with more elements than you really need (I am more than willing to be proved wrong on this point though!) The same goes for multi-dimensional arrays really. I've never found an over-riding reason to use Dynamic arrays other than the fact that it's "better practice".
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/20/2006 1:50:53 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
I will second ginolard's opinion and state that any time I have seen the need for multidimensional arrays, dictionaries have provided a cleaner solution.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/20/2006 2:52:04 AM
|
|
 |
|
| |
ginolard
Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
|
Ah, dictionaries. I cannot agree with ebgreen's statement strongly enough. For 1 or 2 dimensional arrays, dictionaries are far far superior to standard multi-dimensional arrays. For arrays with more than 2 dimensions just Dim them larger than you need (e.g. Dim MultiArray(1000,1000,1000) sure, OK, there'll be some blank entries in there because you can't redim the whole array (only the last dimension) but it's a small price really.
_____________________________
Author of ManagePC - http://managepc.net AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm
|
|
| |
|
|
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/21/2006 1:22:16 AM
|
|
 |
|
| |
ebgreen
Posts: 5246
Score: 31
Joined: 7/12/2005
Status: offline
|
Perl was my first scripting language. It is not unusual to see a hash of hashes of arrays of hashes or some similar crazy data structure.
_____________________________
"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm http://www.visualbasicscript.com/m_47117/tm.htm
|
|
| |
|
|
|
 |
RE: Creating and Referencing Multidimensional arrays - 11/21/2006 2:36:54 AM
|
|
 |
|
| |
TNO
Posts: 1397
Score: 16
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
Quoted from the WSH documentation: quote:
A Dictionary object is the equivalent of a PERL associative array.... ...Items can be any form of data, and are stored in the array.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
|
|