[Remind-Fans] syntax help
Tim Chase
remind at tim.thechases.com
Thu Jul 20 20:23:43 EDT 2023
On 2023-07-20 14:00, Eben King via Remind-fans wrote:
> OK. Here's the situation. I have movie nights twice a week, "Movie Night"
> on Friday, and "Auxiliary Movie Night" on Tuesday. On Tuesday, Mom always
> chooses the movie, and on Friday we alternate between me (Eben) and the wife
> (Amanda). So I want to make a function that spits out the right name,
> depending on what day it is.
I'd do something like
# "beginning of time" according to Remind
SET BOT date(baseyr(), 1, 1)
FSET moviechooser(d) iif(wkdaynum(d) == 2,\
"Mom", \
iif((d - BOT) % 14 < 8, "Eben", "Amanda") \
)
REM Tuesday MSG Get stuff ready for a %"Movie Night [moviechooser($T)]%"
REM Friday MSG Get stuff ready for a %"Movie Night [moviechooser($T)]%"
(adjusting my MSG to your corresponding RUN)
If you happen to invoke it on other days, you and Amanda get
alternating weeks.
> Is there a more succinct way of getting a day counter other than
> by doing realtoday() - 2000-01-01 ?
You need the iif() as mentioned in the other replies. I'm not sure
that realtoday() is what you want, getting the current date even
if you ask for a calendar on another day such as
demo at host:~ $ rem # run on 2023-7-21
Reminders for Friday, 21st July, 2023 (today):
Get stuff ready for a Movie Night Eben
demo at host:~ $ rem -q 2023-7-28
Reminders for Friday, 28th July, 2023:
Get stuff ready for a Movie Night Eben
so you see that you're on both days. If you use $T instead
demo at host:~ $ rem -q 2023-7-21
Reminders for Friday, 21st July, 2023 (today):
Get stuff ready for a Movie Night Eben
demo at host:~ $ rem -q 2023-7-28
Reminders for Friday, 28th July, 2023:
Get stuff ready for a Movie Night Amanda
If you need to swap which date is yours, swap your names in the
interior iif()
-tim
More information about the Remind-fans
mailing list