Chris,

An easy way of extracting todays log-entries would be to shell out and use the Find command
to look for date on the format YYYYMMDD and pipe the result to 'todays' logfile
(This can be done because each log entry always contains the date)

Example:

code:

$LogFile = "c:\program files\somedir\log.txt"
$YYYYMMDD = Left(@Date, 4) + SubStr(@Date, 5, 2) + Right(@Date, 2)
$TodayLog = "c:\program files\somedir\" + $YYYYMMDD + ".txt"
Shell '%COMSPEC% /C Type "$LogFile" | Find "$YYYYMMDD" > "$TodayLog"'

In order to retrieve yesterdays log you have to do some date calculations. If you use Kix version 4
you can do that using the UDF SerialDate()

Example:

code:

$TodayInt = SerialDate(@Date) ; Convert date to number
$YesterdayInt = $TodayInt - 1 ; Subtract 1 from date = yesterday
$DateSep = SerialDate($YesterdayInt) ; Convert to date on format: YYYY/MM/DD
$YYYYMMDD = Left($DateSep, 4) + SubStr($DateSep, 5, 2) + Right($DateSep, 2)
$LogFile = "c:\program files\somedir\log.txt"
$DayLog = "c:\program files\somedir\" + $YYYYMMDD + ".txt"
Shell '%COMSPEC% /C Type "$LogFile" | Find "$YYYYMMDD" > "$DayLog"'
Return

function SerialDate($ExpD)
; Author: ScriptLogic Corporation
; parameter ($ExpD) must be a date (in the form of yyyy/mm/dd)
; or an integer previously derived by this function.
; if passed a date, it returns an integer.
; If passed an integer, it returns the date.
; Integers can be used for general-purpose math computations on dates
; and then converted back to dates by calling this function again.
; Algorithms were obtained from: http://www.capecod.net/~pbaum/date/date0.htm
dim $z,$h,$a,$b,$c,$y,$m,$d
if instr($ExpD,'/') ; date passed
$y=val(substr($ExpD,1,4))
$m=val(substr($ExpD,6,2))
$d=val(substr($ExpD,9,2))
if $m<3
$m=$m+12
$y=$y-1
endif
; return an integer
$SerialDate=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306
else ; integer passed
$z=0+$ExpD+306 ; force numeric
$h=100*$z-25
$a=$h/3652425
$b=$a-$a/4
$y=(100*$b+$h)/36525
$c=$b+$z-365*$y-$y/4
$m=(5*$c+456)/153
$d=$c-(153*$m-457)/5
if $m>12
$y=$y+1
$m=$m-12
endif
if $m<=9
$m='0'+$m
endif
if $d<=9
$d='0'+$d
endif
; return a string date
$SerialDate=''+$y+'/'+$m+'/'+$d
endif
endfunction

-Erik

[ 27 January 2002: Message edited by: kholm ]