[Remind-Fans] function to print AND run a program?

Tim Chase remind at tim.thechases.com
Wed Jun 30 14:10:19 EDT 2021


On 2021-06-30 13:25, Eben King via Remind-fans wrote:
> Hi people.  My events are almost all timed and for "today", like so:
> 
> REM [realtoday()] AT 12:45 MSG Go eat #2 1 8
> 
> I would like a way to schedule an event so that it shows up in
> tkremind (RUN doesn't) and runs a program (MSG doesn't).  There
> almost certainly is a way (maybe a function that calls both
> things?), but I couldn't find it in searching the mailing list
> archives and man page.  Thanks.

There's a shell() command you can use to run a program in a MSG/MSF
entry.

 FSET r() shell("script.sh", -1)
 REM [realtoday()] at 12:45 MSG Go eat [r()]

By wrapping up the command(s) you want in a shell script (discarding
or producing whatever output you want), it should give you control
over what gets run and how frequently.  If the script isn't
idempotent, you might see if the ONCE keyword helps.

> Every day I have to enter 6-8 events like that (usually only the
> time changes), so compact is good.  I don't mind having extensive
> user functions defined elsewhere, as long as the actual REM call
> doesn't get too wordy. Right now I'm scheduling with remind,
> looking at the parsed schedule with tkremind, and setting alarms on
> my cell phone, which is decidedly suboptimal.

Granted, entering some of that by hand on a phone can be a pain, so
I'd investigate some sort of templating option that would
automatically add the entries.  Or, if the times are all relative to
a single time, I'd create a variable and use expressions, something
like

  SET start time(12,45)
  REM [realtoday()] AT [start] MSG First thing
  REM [realtoday()] AT [start+45] MSG Middle thing
  REM [realtoday()] AT [start+90] MSG Later thing
  REM [realtoday()] AT [start+180] MSG Last thing

Then you only have to update the value for `start` and all the other
times fall into place relative to that start time.  Not sure if it's
helpful, but I'm all about the lazy. :-)

-tim




More information about the Remind-fans mailing list