;========================================================================================================================================== ; ; Which variable types can be stored into a cell of a WinBatch array? ; ;------------------------------------------------------------------------------------------------------------------------------------------ ; (c)Detlev Dalitz.20120224. ;========================================================================================================================================== ; Define some variables with different variable type. intInteger = 123 strText = "ansi text" strFileTemp = FileCreateTemp ("WB") hdlFile = FileOpen (strFileTemp, "WRITE") fltFloat = 1.23 hdlBinaryBuffer = BinaryAlloc (0) strUnicode = ChrStringToUnicode ("unicode text") ; arrTest | = ArrDimension(1) ; Not possible to embedd array variable into array cell. varVariant = ObjectType ("ARRAY", Arrayize ("1", " ")) objObject = ObjectCreate ("Shell.Application") ; Define array to hold previously defined variables. arrTestVT = ArrDimension (9, 4) ArrInitialize (arrTestVT, "") arrTestVT[0, 0] = intInteger arrTestVT[0, 1] = "Integer" arrTestVT[0, 2] = 1 arrTestVT[0, 3] = VarType (arrTestVT[0, 0]) arrTestVT[1, 0] = strText arrTestVT[1, 1] = "String" arrTestVT[1, 2] = 2 arrTestVT[1, 3] = VarType (arrTestVT[1, 0]) arrTestVT[2, 0] = hdlFile arrTestVT[2, 1] = "File Handle" arrTestVT[2, 2] = 4 arrTestVT[2, 3] = VarType (arrTestVT[2, 0]) arrTestVT[3, 0] = fltFloat arrTestVT[3, 1] = "Floating Point Value" arrTestVT[3, 2] = 32 arrTestVT[3, 3] = VarType (arrTestVT[3, 0]) arrTestVT[4, 0] = hdlBinaryBuffer arrTestVT[4, 1] = "Binary Buffer" arrTestVT[4, 2] = 64 arrTestVT[4, 3] = VarType (arrTestVT[4, 0]) arrTestVT[5, 0] = strUnicode arrTestVT[5, 1] = "LPWSTR or Unicode" arrTestVT[5, 2] = 128 arrTestVT[5, 3] = VarType (arrTestVT[5, 0]) ; It is not possible to embedd array into array cell. ; arrTestVT[6,0] = arrTest arrTestVT[6, 1] = "Array" arrTestVT[6, 2] = 256 ; arrTestVT[6,3] = VarType (arrTestVT[6,0]) arrTestVT[7, 0] = varVariant arrTestVT[7, 1] = "Variant" arrTestVT[7, 2] = 512 arrTestVT[7, 3] = VarType (arrTestVT[7, 0]) arrTestVT[8, 0] = objObject arrTestVT[8, 1] = "COM/OLE Object" arrTestVT[8, 2] = 1024 arrTestVT[8, 3] = VarType (arrTestVT[8, 0]) ; Display info. For intI = 0 To 5 strMsgTitle = "Test | VarType of Array Elements | Elem=" : intI strMsgText = "Variable Value = " : arrTestVT[intI, 0] strMsgText = strMsgText : @LF : @LF : "VarType Name = " : arrTestVT[intI, 1] strMsgText = strMsgText : @LF : @LF : "VarType Value = " : arrTestVT[intI, 2] strMsgText = strMsgText : @LF : @LF : "Complex VarType Value = " : arrTestVT[intI, 3] Pause (strMsgTitle, strMsgText) Next intI = 6 strMsgTitle = "Test | VarType of Array Elements | Elem=" : intI strMsgText = "Variable Value = [Not possible to embedd array into array cell]" strMsgText = strMsgText : @LF : @LF : "VarType Name = " : arrTestVT[intI, 1] strMsgText = strMsgText : @LF : @LF : "VarType Value = " : arrTestVT[intI, 2] strMsgText = strMsgText : @LF : @LF : "Complex VarType Value = " : arrTestVT[intI, 3] Pause (strMsgTitle, strMsgText) intI = 7 strMsgTitle = "Test | VarType of Array Elements | Elem=" : intI strMsgText = "Variable Value = [Variant has no string representation]" strMsgText = strMsgText : @LF : @LF : "VarType Name = " : arrTestVT[intI, 1] strMsgText = strMsgText : @LF : @LF : "VarType Value = " : arrTestVT[intI, 2] strMsgText = strMsgText : @LF : @LF : "Complex VarType Value = " : arrTestVT[intI, 3] Pause (strMsgTitle, strMsgText) intI = 8 strMsgTitle = "Test | VarType of Array Elements | Elem=" : intI strMsgText = "Variable Value = " : arrTestVT[intI, 0] strMsgText = strMsgText : @LF : @LF : "VarType Name = " : arrTestVT[intI, 1] strMsgText = strMsgText : @LF : @LF : "VarType Value = " : arrTestVT[intI, 2] strMsgText = strMsgText : @LF : @LF : "Complex VarType Value = " : arrTestVT[intI, 3] Pause (strMsgTitle, strMsgText) :CANCEL objObject = 0 hdlFile = FileClose (hdlFile) hdlBinaryBuffer = BinaryFree (hdlBinaryBuffer) FileDelete (strFileTemp) Exit ;==========================================================================================================================================