home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD2.bin
/
bbs
/
biz
/
dfa-2.2.lha
/
DFA
/
Rexx
/
ArexxScripts.lha
/
RemindBirthday.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1994-09-16
|
5KB
|
144 lines
/************************************************************************/
/* CheckBirthdays.rexx by Frank Pecher */
/* changed for DFA V2.0 by Dirk Federlein */
/* */
/* */
/* Check for birthdays in the next few days. */
/* */
/* SYNTAX */
/* CheckBirthdays */
/* */
/* FUNCTION */
/* This script checks all entries of the current DFA data file and */
/* examines the birthday-field, checking for birthdays in the next */
/* days. This way forgetting your friend's, parents', aunts' and */
/* uncles' birthdays becomes very hard;-}. */
/* */
/* Put this in your Startup-Sequence, or create an IconX */
/* project icon and put it into SYS:WBStartup, and you will be */
/* reminded for pending birthdays everytime right after booting */
/* your computer. */
/* */
/* REQUIREMENTS */
/* The date format in the birthday field must have one of the */
/* following formats: */
/* DD.MM.YYYY like 13.08.1968 */
/* DD.MM.YY like 13.08.68 */
/* DD.MM. like 13.08. */
/* In the first two cases, you will additionally be reminded */
/* how old a person is going to be. */
/* */
/* CONFIGURATION */
/* To configure this script to your taste, edit the initialization */
/* of the two variables */
/* DAYSBEFORE - the number of days you like to be reminded */
/* before a birthday. */
/* DAYSPASSED - the number of days you like to be reminded */
/* after a birthday (good when coming home from holidays). */
/************************************************************************/
DAYSBEFORE = 21
DAYSPASSED = 5
/*************************************************************************
** main
*/
if ~show(ports, DFA) then
do
say "Start DFA first."
exit 0
end
options RESULTS
/* Disable listview refresh of DFAEditor */
address "DFA" gui output off input off
address "DFA" first stem p.
today = date(i)
thisyear = substr(date(s), 1, 4)
do while RC = 0
bday = p.address.9
if bday ~= "" then
do
birthday = ConvDate(p.address.9, thisyear)
first = p.address.1
name = p.address.2
if birthday ~= 0 then
do
first = p.address.1
name = p.address.2
diff = birthday - today
if right(p.address.9, 1) = "." then
do
howold = ""
st = ""
end
else
do
howold = right(thisyear, 2) - right(p.address.9, 2)
if howold < 0 then
howold = howold + 100
howlast = right(howold, 1)
select
when howlast = 1 then st = "st "
when howlast = 2 then st = "nd "
when howlast = 3 then st = "rd "
otherwise st = "th "
end
end
if (diff = 1) | (diff = -1) then
days = "day"
else
days = "days"
if (diff > 0) & (diff < DAYSBEFORE) then
say "In "diff days" is "first name||x2c(27)"s "howold||st"birthday."
if (diff = 0) then
say "*** Today is "first name||x2c(27)"s "howold||st"birthday. ***"
if (diff < 0) & (-diff < DAYSPASSED) then
say diff * (-1) days" ago was "first name||x2c(27)"s "howold||st"birthday."
end
end
address "DFA" next stem p.
end
/* Enable listview refresh of DFAEditor */
address "DFA" gui output on input on
exit 0
/******************************************************************************
** ConvDate()
*/
ConvDate: procedure
arg bday,thisyear
parse VAR bday day"."month"."year
if length(day) < 2 then
day = 0||day
if length(month) < 2 then
month = 0||month
bd = thisyear||month||day
return date(i, bd, s)