Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Debug DebugTrace Log Error WBERRORHANDLER IntControl 73 77 Variable Table Dump
#DefineSubRoutine OnNextError(Err_Array) strFileOut = DirScript():"out.txt" lasterr = wberrorarray[0] handlerline = wberrorarray[1] textstring = wberrorarray[5] linenumber = wberrorarray[8] errstr = StrCat("Number: ",lasterr,@LF,"String: ",textstring,@LF,"Line (",linenumber,"): '",handlerline,"'") ; 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 type = VarType(%strVarName%) If type ==0 ; Cannot be unitialized arrA[intI, 1] = '*UNDEFINED*' ElseIf type == 256 ; Cannot be an array arrA[intI, 1] = '*ARRAY*' Else arrA[intI, 1] = %strVarName% ; Content of Variable. EndIf Next ; Write array to file. intBytesWritten = ArrayFilePutCSV (strFileOut, arrA) ; Display file. Run (strFileOut, "") Return(1);Re-arm error handler #EndSubRoutine ; Initialize Error Handler IntControl(73,3,0,"OnNextError",0) ; Define some WIL variables. VarMike = "I wanna see this message" strTest = "This is a test string." fltNum = 1234.56 badline=Message(aaaa,bbbb) Exit
Article ID: W17870
Filename: Write Variable Table To File Upon Error.txt
File Created: 2010:09:29:10:30:14
Last Updated: 2010:09:29:10:30:14