Hi,
At the link below this guy describes this subject brilliantly on the
officient use of arrays.
http://www.codingforums.com/showthread.php?threadid=26874
Warm regards.
Martin Webster.
--- On Thu, 3/1/12, BT <[email protected]> wrote:
> From: BT <[email protected]>
> Subject: Re: Very Large Array Storage
> To: [email protected]
> Date: Thursday, March 1, 2012, 5:30 AM
>
> Hi Dave,
>
> Yes, the underline (_) is a continuation to
> the next line.
> I gave you the best example to make your array, name each
> element of the
> array using a dictionary and the ReDim does allow you to be
> flexible even
> though you may never need to increase the size of your
> array.
> Below is the best references for you from
> Microsoft. The first link does
> it all by category which is the best way to get started.
> Bruce
>
> VB Script Library Index, Features By Category:
> http://msdn.microsoft.com/en-us/library/273zc69c.aspx
>
>
> VB Scripts Library Reference Short Index:
> http://msdn.microsoft.com/en-us/library/d1wf56tt(v=VS.85).aspx
>
> VB Script Fundamentals Short Index:
> http://msdn.microsoft.com/en-us/library/0ad0dkea.aspx
>
> VB Script Events Short Index:
> http://msdn.microsoft.com/en-us/library/chyc36ds(v=VS.85).aspx
>
> Objects and Collections:
> http://msdn.microsoft.com/en-us/library/22h7a6k8(v=VS.85).aspx
>
> VB Script Create Object:
> http://msdn.microsoft.com/en-us/library/dcw63t7z.aspx
>
> VB Script Get Object:
> http://msdn.microsoft.com/en-us/library/kdccchxa.aspx
>
> Windows Desktop Index:
> http://msdn.microsoft.com/en-us/library/windows/desktop/
>
> Windows Autamation Index:
>
http://msdn.microsoft.com/en-us/library/windows/desktop/ms221375(v=vs.85).aspx
>
> COM Components Index:
>
http://msdn.microsoft.com/en-us/library/windows/desktop/ms680573(v=vs.85).aspx
>
> Writing an automation server (like Window-Eyes)
> instead of an automation
> client (like a script.)
> VARIANT types helper functions:
>
http://msdn.microsoft.com/en-us/library/windows/desktop/ms221673%28v=vs.85%29.aspx
>
> Using IConnectionPointContainer and
> IConnectionPoint:
>
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683857%28v=vs.85%29.aspx
>
>
> VB Script ActiveXObject (Only Works In Internet
> Explorer)
> http://msdn.microsoft.com/en-us/library/7sw4ddf8(v=VS.85).aspx
>
>
> Sent: Wednesday, February 29, 2012 10:49 PM
> Subject: Re: Very Large Array Storage
>
>
> Thank you, Bruce. It does help. Of particular interest is
> how 'r(1)'
> could refer to element in r(1)(1), when, being 0 based, and
> 1
> refering to the second array should have displayed 100, i.e.
> r(1)(0)
> is 100. It seems ambiguous. The second set of parenthesis
> making the
> index into the second array is not ambiguous and makes
> matters much clearer.
>
> What is also intrigueing is the '_' in what I think of as a
> line
> continuation spot, similar to theLinux '\'. Is this for
> real? Or,
> were you merely using that as a break character. I'm unaware
> of
> VBScript having a line continuation mark. I understand the
> ':' as a
> way to tell VBS to treat the two sides of the ':' as
> separate lines.
> but, I never knew of a line continuation mark!
>
> Thanks again...
>
> Dave
>
>
> At 01:37 PM 2/29/2012, you wrote:
>
> >Hi Dave,
> >
> > I suspect there are many things
> you are looking into. Below is an
> >example of making arrays. Now in your script section you
> declare the
> >variables and assign them there. Now I suspect you want
> a dynamically
> >loaded
> >array.
> >' Making an array of arrays:
> >ar = Array( Array(10, 11, 12, 13,14, 15), _
> >Array(100, 102, 104, 106, 108, 110))
> >
> >Dim result: result = ar(1)
> >msgBox result(1)
> >Your display is: 102
> >msgBox ar(1)(2)
> >Your Display Is: 104
> >
> > It takes the second array,
> because all VB arrays are 0 based and 1 was
> >selected to use and the first one wanted the second
> element for the same
> >reasoning, thus you get 102. The second one approaches
> it directly instead
> >of making a second assignment, it looks at the array
> inside the array, thus
> >must use the second parens to get to it, because the
> first one is an array,
> >thus the second set of parens reflects it's properties.
> >
> > This is an example of declaring
> and setting.
> >
> > You can also set many arrays in
> the first dim and use those names and
> >make a second array like above and use each name of the
> first in the
> >second.
> >Now you can change the size at will by using the Redim
> as I stated below at
> >any time. Noting that data elements of the array are
> lost if you shrink any
> >element of the array. Those not included are lost at
> that point.
> >
> > So if you shrink your array
> loaded with arrays, then those arrays
> > above
> >the redim statement will all be lost.
> >
> > You can keep track of your
> arrays by number or by storing those
> > numbers
> >in a dictionary and assigning a name to each number
> inside the dictionary.
> >This would allow you to keep track of all your arrays by
> name by
> >associating
> >that name to a given number, or row of the array.
> >
> > I hope this helps.
> > Bruce
> >
> >Sent: Wednesday, February 29, 2012 12:09 AM
> >Subject: Re: Very Large Array Storage
> >
> >
> >Thank you, Bruce. I thought I would use the DynArray
> facility from
> >the toolkit since I know I have the 50 static entries in
> the first
> >dimension. If I were doing this in C, I would actually
> have the
> >elements of this dimension 50 array consist of pointers
> to integer
> >arrays, one at each index. I would build this array by
> locating the
> >index into the 50 static array and then append another
> integer onto
> >the end of the integer array pointed to by that entry. I
> thought I
> >could use the DynArray method 'add' to accomplish this.
> >
> >The trouble is, I'm not doing pointers. I see no way of
> declaring the
> >first and static array which has a known size after all,
> of being an
> >array of dynamic array elements. I know the integers in
> each dynamic
> >array are sorted as I build the thing. I plan to use
> other variables
> >to track locations within the dynamic array of integers
> etc.
> >
> >So, that is one problem, how to tell VBScript that the
> staticArray(5)
> >has a DynamicArray() which may have indexes from 0 to
> the method
> >'total' or 'count' (I forget what it is called exactly.
> In
> >programming languages, one usually has to specify the
> elements the
> >array contains. int *StaticArray[] comes to mind. The
> compiler
> >understands that the array StaticArray is of unknown
> length and
> >points to int; that is StaticArray is an array of
> pointers to int.
> >How does VBScript come to "understand" that in my case,
> StaticArray
> >is an array of known length, but that the elements of
> that array are
> >themselves, arrays of integers?
> >
> >The second problem is how to store about 8500 integers?
> Again, I want
> >this to be a global script. Usually there is some sort
> of
> >initialization doen on an instance of an object. I can't
> remember the
> >term for it, but when the object is instantiated, there
> is an implied
> >initialization of that object before its properties and
> methods are
> >available. Even when the object is done with and
> destroyed, there is
> >some 'finalization" or clean up to take care of resource
> reclaimation etc.
> >
> >So, if I could do the initialzation when this global
> script starts,
> >the integers would be there and the routines invoked at
> script
> >activation time would find the arrays ready for reading.
> By the way,
> >the integers are all read only. The user may not fiddle
> with the data
> >set in any way, except to read them. No writing allowed.
> If the
> >script is unloaded, the memory and any other overhead
> resources could
> >be reclaimed. I don't know how to do this sort of
> stuff.
> >
> >Thanks for the help. This is certainly an interesting
> challenge for me!
> >
> >Dave
> >
> >
> >
> >At 01:17 PM 2/28/2012, you wrote:
> >
> > >Hi Dave,
> > >
> > > You first dim your array
> with just () or parens.
> > > At any time you can add to
> or delete from the array using the redim
> > >statement.
> > >Now, to preserve existing data you use the word
> preserve. without that
> > >word
> > >all data in your array is lost.
> > >
> > > Now the next thing is you
> can increase size or dimensions but can
> > > not
> > > do
> > >the reverse. ReDim takes the last dimension and
> increases it, or adds
> > >another dimension on to it.
> > > So you can erase the
> entire array by just given it a dim or redim
> > >command.
> > >Format:
> > >'In the app body or init section
> > >Dim YourArray()
> > >' Make an initial size of 40 with no data inside.
> > >ReDim YourArray(40)
> > >' When Inside sub or functions increase the size:
> > >ReDim Preserve YourArray(6000)
> > >' To Increase dimensions:
> > >ReDim Preserve YourArray(6000, 4)
> > >'Note:
> > >' Remember you can not go backward or
> any data in those dimensionns or
> > >locations will be lost.
> > >'Such as
> > >ReDim Preserve YourArray( 6000, 2)
> > >'You have lost all data in the 3'rd and 4'th
> dimensions.
> > >ReDim Preserve YourArray(6000)
> > >'You lost all data in the second dimension.
> > >ReDim Preserve YourArray(40)
> > >'You are now down your original size and all data
> above that is lost.
> > >
> > > I hope this helps. Any
> saving of data for future useage either put
> > > them
> > >in an iniFile or external file as mentioned by
> others.
> > > Bruce
> > >
> > >Sent: Tuesday, February 28, 2012 12:22 PM
> > >Subject: RE: Very Large Array Storage
> > >
> > >
> > >Hello,
> > >Thanks for your reply. I'm not actually polling
> anything. I refered
> > >to the collection (not a technical term, just a
> set) of arrays to
> > >hold integers in an organized manner. They are more
> like mapping
> > >arrays and ordered integers. An anology would be an
> static array of
> > >of dynamic arrays like a list of variable length
> strings.
> > >
> > >Thanks...
> > >
> > >Dave
> > >
> > >
> > >At 07:56 AM 2/28/2012, you wrote:
> > > >What kind of database are you pulling from?
> Will you be using SQL to
> > > >perform
> > > >the retrieval?
> > > >
> > > >-----Original Message-----
> > > >From: David Helkenn [mailto:[email protected]]
> > > >Sent: Tuesday, February 28, 2012 8:55 AM
> > > >To: [email protected]
> > > >Cc: [email protected]
> > > >Subject: Very Large Array Storage
> > > >
> > > >Hello,
> > > >I want to write an app that will require a
> fairly large database
> > > >organized
> > > >in arrays. There are around 8500 integer
> elements to be stored in some
> > > >35
> > > >arrays. I thought I could have a static array
> of the 35 dynamic arrays
> > > >containing the integers. However, I do not
> know how to get all that
> > > >data
> > > >initialized prior to the invokation of the
> rest of the app. How do I
> > > >get
> > > >that data known to the app?
> > > >
> > > >The behavior from a very high view, is the
> user presses the activation
> > > >hotkey, the controls are displayed in the
> dialog and the database is
> > > >available for use. I do not know how long it
> will take to create the
> > > >database, but it is subject to an easily
> implemented algorithm.
> > > >
> > > >I am hoping to have this app as global. Will I
> need to use a file? If
> > > >so,
> > > >where is the documentation related to the file
> system? I find only a
> > > >file/dir related document but there is no FSO
> in the GW toolkit. Help
> > > >please.
> > > >
> > > >Using Windows7pro64 and WE 7.5.3.
> > > >
> > > >Thanks...
> > > >
> > > >Dave
>
>