Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


How to Create a History Log File

Keywords:  log file Log function Meter metering software.  

Here's an example of a history log file that you can create:

 
curdir=Dirget()
DirChange(curdir)

LogFile="MYLOG.INI"

User=AskLine("LOG","Enter User Name","Fred")    ; title, prompt, default answer

TimeOn=DateTime()    ;current timedate

Program=AskLine("LOG","Enter desired Program","NOTEPAD.EXE")  ; title, prompt, default answer

RunWait(Program,"")    ;runs notepad with no parameters  and waits to finish

TimeOff=DateTime()     ; get current timedate again

LogLine=strcat(User,"|",Program,"|",TimeOn,"|",TimeOff);Fred|NOTEPAD.EXE|Tues 5/13/97 1:36 PM|Tues 5/13/97 1:40 PM

Line=IniWritePvt("LOG","Counter",LogLine, Logfile);section, keyname, default, filename=MYLOG.INI

Line=Line+1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

User=AskLine("LOG","Enter User Name","Wilma")    ; title, prompt, default answer

TimeOn=DateTime()    ;current timedate

Program=AskLine("LOG","Enter desired Program","NOTEPAD.EXE")  ; title, prompt, default answer

RunWait(Program,"")    ;runs notepad with no parameters  and waits to finish

TimeOff=DateTime()     ; get current timedate again

LogLine=strcat(User,"|",Program,"|",TimeOn,"|",TimeOff);Fred|NOTEPAD.EXE|Tues 5/13/97 1:36 PM|Tues 5/13/97 1:40 PM

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WRITE PART;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Line=IniWritePvt("LOG","Counter2",LogLine, Logfile);section, keyname, default, filename=MYLOG.INI

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;READ PART;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

a=IniReadPvt("LOG","Counter",0,LogFile);section, keyname, default, filename=MYLOG.INI

b=IniReadPvt("LOG","Counter2",LogLine,LogFile);section, keyname, default, filename=MYLOG.INI

message("file contains", "%a%%@crlf%%b%")

For a nice example of a Software Metering script from one of our users, see:

http://techsupt.windowware.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Samples~from~Users+Software~Metering~Example.txt 

Article ID:   W13283
Filename:   A History Log File.txt