Thread VBScript Arrayhandling (11 answers)
Opened by esskar at 2004-07-28 20:18

esskar
 2004-07-28 20:18
#10512 #10512
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
Quote
Dim A(10)
Although the number shown in the parentheses is 10, all arrays in VBScript are zero-based, so this array actually contains 11 elements. In a zero-based array, the number of array elements is always the number shown in parentheses plus one. This kind of array is called a fixed-size array.

You assign data to each of the elements of the array using an index into the array. Beginning at zero and ending at 10, data can be assigned to the elements of an array as follows:

A(0) = 256
A(1) = 324
A(2) = 100
. . .
A(10) = 55


set brauchst du beim objekten

also

Code: (dl )
1
2
3
4
Dim obj

Set obj = GetObject(...)
A(0) = obj


und "ls" geht z.b. so

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
Function GetFolderList(folderspec)
Dim fso, f, f1, fc, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(folderspec)
Set fc = f.Files
For Each f1 in fc
s = s & f1.name
s = s & "\n"
Next
GetFolderList = s
End Function

View full thread VBScript Arrayhandling