How can I determine if a dynamic array has not be dimensioned in VBScript
I don't think there's anything built in, but you can create your own function as:
Function IsInitialized(a) Err.Clear On Error Resume Next UBound(a) If (Err.Number = 0) Then IsInitialized = True End IfEnd Function
Which you can then call as:
Dim myArray()If Not IsInitialized(myarray) Then WScript.Echo "Uninitialized"End If
However, one way to work around it might be to not declare empty arrays, instead declare just a variable and set it to an array later, so change the code above to:
Dim myArraymyArray = Array()If Not IsInitialized(myarray) Then WScript.Echo "Uninitialized"End If