Inspired by Evernote, I whipped up a little script to find “@reminder” tags with date parameters in nvALT notes (or any folder of text files). It can generate notifications or send HTML emails at the specified time. It’s just for fun right now, but I thought I’d put it out there to see if anyone had any ideas for it.

It’s called “nvremind” (pronounced “never mind”) and it’s up on Github. The README covers it pretty well:

This tool will search for @remind() tags in the specified notes folder. It searches “.md”, “.txt” and “.taskpaper” files.

It expects an ISO 8601 format date (2013-05-01) with optional 24-hour time (2013-05-01 15:30). Put @remind(2013-05-01 06:00) anywhere in a note to have a reminder go off on the first run after that time.

This script is intended to be run on a schedule. Check for reminders every 30-60 minutes using cron or launchd.

Use the -n option to send Mountain Lion notifications instead of terminal output. Clicking a notification will open the related file in nvALT.

Use the -e ADDRESS option to send an email with the title of the note as the subject and the contents of the note as the body to the specified address. Separate multiple emails with commas. The contents of the note will be rendered with MultiMarkdown, which needs to exist at /usr/local/bin/multimarkdown.

If the file has a “.taskpaper” extension, it will be converted to Markdown for formatting before processing with MultiMarkdown. [[Links]] and @tags will be clickable to load notes and searches in nvALT.

There are a few requirements:

  1. If you want Mountain Lion notifications, you need to install the ‘terminal-notifier’ gem (sudo gem install terminal-notifier).
  2. For the time being, sending email requires that you have MultiMarkdown installed at /usr/local/bin/multimarkdown. I’ll add a fallback for that one soon.
  3. nvremind uses sendmail to send emails. This should “just work,” but there may be some setup I’m forgetting about. I do that stuff late at night.

You can schedule it to run with launchd by putting a plist like this in “~/Library/LaunchAgents/com.brettterpstra.nvremind”:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.brettterpstra.nvremind</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/ruby</string>
        <string>/usr/local/bin/nvremind.rb</string>
        <string>-r</string>
        <string>-e</string>
        <string>your@emailaddress.com</string>
        <string>~/Dropbox/nvALT2.2</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>StartInterval</key>
    <integer>1800</integer>
</dict>
</plist>

That will run the script every 30 minutes, and if you edit the dummy email address with your own, you should start receiving reminders. The command it runs is:

/usr/bin/ruby /usr/local/bin/nvremind.rb -r -e your@emailaddress.com ~/Dropbox/nvALT2.2

This assumes you stuck the script in “/usr/local/bin/nvremind.rb,” but you can edit that to point anywhere. The -r will turn “@remind” into “@reminded” so it won’t trigger again in the future. The -e address option enables emails and the final argument should be the folder where you store your nvALT notes as text files.

I do recommend picking up LaunchControl for working with launchd scheduling. If you’re old school, you can always use cron for this as well.

Next up I think I’m going to add a quick AppleScript bridge so it can add reminders to Reminders.app and OmniFocus. That should probably be where I started, actually. Oh, well.

Feel free to play, and let me know if you think of anything truly useful you could do with this.