WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Arrays
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Variable Table to Array

 Keywords:  Variable Table Array IntControl 77

DirChange (DirScript ())

strFileThis = IntControl (1004, 0, 0, 0, 0)
strFileOut = ItemReplace ("out.txt", -1, strFileThis, ".")

; Define some WIL variables.
VarMike = "I wanna see this message"
strTest = "This is a test string."
fltNum = 1234.56

; Create list of variable names.
strVarList = IntControl (77,12,0,0,0) ; Tab-delimited list of variables assigned.

; Create array to store the variable name and the content of the variable in one row.
intVarCount = ItemCount (strVarList, @TAB)
arrA = ArrDimension (intVarCount, 2) ; Array of Variable Name|Content of Variable.
intLast = intVarCount - 1

For intI = 0 To intLast
   strVarName =  ItemExtract (intI + 1, strVarList, @TAB) ; Variable Name.
   arrA[intI, 0] = strVarName
   arrA[intI, 1] = %strVarName% ; Content of Variable.
Next

; Write array to file.
intBytesWritten = ArrayFilePutCSV (strFileOut, arrA)

; Display file.
Run (strFileOut, "")

:CANCEL
Exit

Article ID:   W17670
Filename:   Variable Table to Array.txt
File Created: 2010:07:09:10:08:22
Last Updated: 2010:07:09:10:08:22