Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Scrolling Log Window Rolling
If anybody could point me in the right direction I would be appreciated.
; let me control the line terminator for FileWrite IntControl(53, 0, 0, 0, 0) AddExtender("WWCTL34i.DLL") gosub SHOW #DEFINESUBROUTINE StartLogging(dlgHandle) date = TimeDate() dir = "C:\Windows\Temp" log = "C:\Windows\Temp\logging.log" status = "Determing number of files in %dir%" ln_break = "*********************************************************" complete = "Complete" strLog = "Logging..." if( DirExist( dir ) == @TRUE ) then DirChange(dir) DialogControlSet(dlgHandle, 9, 4, dir) lHandle = FileOpen(log, "WRITE") if( lHandle != 0 ) ; ; Logging... ; line = StrLog FileWrite(lHandle, line) strLog = StrCat(strLog, @CRLF ) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) ; ; Date: mm-dd-yyyy HH:MM:SS ; date = TimeDate() line = StrCat( "Date: ", date, @CRLF) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) ; ; Determing number of temporary files in %dir% ; line = StrCat( status, @CRLF ) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) ; ; ********************************************************* ; line = StrCat(ln_break, @CRLF) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) list = FileItemize("%dir%\*.*") count = ItemCount(list, @TAB) totalsize = 0 for i = 1 to count current = ItemExtract(i, list, @TAB) strFile = current DialogControlSet(dlgHandle, 7, 4, strFile) TimeDelay(0.005) thissize = FileSize(strFile) totalsize = thissize + totalsize strSize = StrCat( thissize, " Bytes") DialogControlSet(dlgHandle, 8, 4, strSize) TimeDelay(0.005) strTotalSize = strcat("Total: ", i, " files ", totalsize, " bytes") DialogControlSet(dlgHandle, 11, 4, strTotalSize) TimeDelay(0.005) line = StrCat(@CRLF) FileWrite(lHandle, line) strLog = strCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) line = StrCat(strFile, " = ", strSize, @CRLF) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) Next ; ; Total: ; line = StrCat("Total: ", count, " files ", totalsize, " bytes", @CRLF ) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) ; ; Complete ; line = StrCat(@CRLF, complete, @CRLF) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) ; ; ********************************************************* ; line = StrCat(ln_break, @CRLF) FileWrite(lHandle, line) strLog = StrCat(strLog, line) DialogControlSet(dlgHandle, 6, 3, strLog) TimeDelay(0.005) FileClose(lHandle) endif endif return 0 #ENDSUBROUTINE #DEFINESUBROUTINE Process(dlgHandle, eventCode, ctrlNum, resv1, resv2) switch( eventCode ) case 0 DialogProcOptions(dlgHandle, 2, 1) return -1 case 2 if( ctrlNum == 1 ) then return -1 if( ctrlNum == 2 ) then return -1 if( ctrlNum == 10 ) then ;Disable buttons while processing... DialogControlState(dlgHandle, 10, 3, 2) DialogControlState(dlgHandle, 1, 3, 2) DialogControlState(dlgHandle, 2, 3, 2) StartLogging(dlgHandle) ;Enable buttons while processing... DialogControlState(dlgHandle, 10, 4, 2) DialogControlState(dlgHandle, 1, 4, 2) DialogControlState(dlgHandle, 2, 4, 2) return -2 ; don't return endswitch return -1 #ENDSUBROUTINE ButtonPushed=Dialog("log") exit :SHOW logFormat=`WWWDLGED,6.1` logCaption=`Logging Example` logX=002 logY=057 logWidth=406 logHeight=232 logNumControls=011 logProcedure=`Process` logFont=`DEFAULT` logTextColor=`DEFAULT` logBackground=`DEFAULT,DEFAULT` logConfig=4513660 log001=`305,213,036,012,PUSHBUTTON,DEFAULT,"OK",1,10,32,DEFAULT,DEFAULT,DEFAULT` log002=`347,213,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,11,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log003=`007,025,044,012,STATICTEXT,DEFAULT,"Current File:",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log004=`007,011,044,012,STATICTEXT,DEFAULT,"Directory:",DEFAULT,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log005=`007,039,044,012,STATICTEXT,DEFAULT,"File size:",DEFAULT,5,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log006=`007,061,380,140,MULTILINEBOX,strLog,"Logging...",DEFAULT,8,8,DEFAULT,DEFAULT,DEFAULT` log007=`057,025,214,012,VARYTEXT,strFile,"current.txt",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log008=`057,039,214,012,VARYTEXT,strSize,"0 KB",DEFAULT,6,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log009=`057,011,214,012,VARYTEXT,strDir,"C:\",DEFAULT,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log010=`299,025,036,012,PUSHBUTTON,DEFAULT,"Begin",2,7,DEFAULT,DEFAULT,DEFAULT,DEFAULT` log011=`007,209,242,012,VARYTEXT,strTotalSize,"Total: 0 files 0 bytes",DEFAULT,9,DEFAULT,"MS Sans Serif|8192|40|34","255|0|0",DEFAULT` RETURN
Article ID: W16204
File Created: 2004:03:30:15:43:14
Last Updated: 2004:03:30:15:43:14