Joe's Clock-Watcher's Problem - Maybe Solved ? ? ?
Bob Stockler
bob at trebor.iglou.com
Fri Dec 12 14:15:48 PST 2008
It just occured to me that I'd written a program some time ago
that wrote the day, date and time to the bottom of a filePro
screen. I don't know why I didn't think of it sooner - I use
the program once a month when I enter data from my Gas and
Electric utility bill into a filePro database. It uses the
KornShell (which probably could be converted to any other modern
shell) and any flavor of AWK. I use it on SCO UNIX.
I hope Joe can edit it to suit his purposes.
============================== cut here ===============================
#!/bin/ksh
# @(#) Prints the Date and Time to the bottom of a filePro screen
# Assign the filePro file name:
export PFNAME=lge
# Assign the screen header:
export HEADER="Louisville Gas & Electric Bills"
# Assign the screen name or number:
export SCREEN=0
# Assign "dclerk" or "rclerk"
export CLERK=rclerk
: ${AWK:=$(whence mawk)} ${AWK:=$(whence gawk)} ${AWK:=$(whence awk)}
: ${CF:=$(tput civis)} ${CN:=$(tput cnorm)} ${md:=$(tput bold)}
: ${me:=$(tput sgr0)}
ECHO="echo -n \"$CF$md`tput cup 24 24` \"" # for row 25 col 25
DATE="/bin/date '+%I:%M:%S %p - %a - %b %e, %Y'"
trap ' print -n "$CN" >/dev/tty ; trap 0 ; exit 0 ' EXIT HUP INT QUIT TERM
trap '' INT QUIT # catch INT or QUIT signals issued in filePro
( $AWK -v CN="$CN" -v ECHO="$ECHO" -v DATE="$DATE" -v me="$me" -v CF="$CF" '
BEGIN { t = 2
while (1) {
system("sleep "t)
DATE | getline date ; close( DATE )
t = 60 - ( ( substr(date,7,2) + 0 ) % 60 )
gsub(/^0|:[0-5][0-9] /," ",date)
system(ECHO date " " me)
}
}' >/dev/tty
) &
BG_PID=$!
$PFPROG/fp/$CLERK $PFNAME -s$SCREEN -h $HEADER
kill -9 $BG_PID
exit 0
# EOF "time"
============================== cut here ===============================
Bob
--
Bob Stockler +-+ bob at trebor.iglou.com +-+ http://members.iglou.com/trebor
More information about the Filepro-list
mailing list