Daily Note-- how to set up a daily note TBX

I’ve been playing around with Roam for the last few weeks and one thing that I really liked was starting having a daily note. Playing with Roam has given me a much deep appreciation for Tinderbox!

I created a test tbx that has the following:

  1. a note for each day
  2. an agent that finds the daily note.

daily note.tbx (523.3 KB)

Question #1: What’s the best way to create a note for each day?

I created this manually by

  • copying all of the dates from 2020 from into a note
  • exploding the note note with a rule that made the $name, $myDate

It only took 5 minutes, but I’m wondering if there is a better approach.

Question #2: Link to all of the daily notes from an index page

Is there a way to automatically link all of the pages together on a 2020 “index” page? I tried to copy/paste wikilinks, but it didn’t work.

[[January 3, 2020]]
[[January 4, 2020]]
[[January 5, 2020]]

Question #3: How do you create an agent to find all of the notes withn ranges?

For example, find all notes within 30 days in the past AND 30 days in the future?

Thanks for any thoughts!

2 Likes

You could use action code or an AppleScript. Within the app you can use create(). One idea is a note with $StartDate set to the first day of the desired run of day notes and $EndDate for the last day. Then (N.B. not tested) use a rule that, if StartDate is >= start data and <= end date, it creates a note in a container with the right name. The target container can set a prototype using its OnAdd (which fires when the new note is created there.

Use $StartDate.format() to generate the desired string for the new note name. Once the note is created you can use a a left-side offset to configure any desired attributes, i.e. $Color(path/to/note)="blue", $StartDate(path/to/note)=$StartDate", etc. The rule is written so the last action is to auto-increment $StartDate. Once $StartDate==$EndDate the work is complete.

Or use AppleScript—see the linked article.

There is currently no way to introspect $Text and make links there. Although Ziplink text link creation uses wiki-like triggering it is a manual process. This task looks like one for AppleScript.

Well, assuming you set $a common prototype you could use:

$Prototype=="pDayNote" & $Name.endsWith("2020")

N.B. even if you don’t have other types of notes that meed the second query test, generally it helps to reduce the number of notes tested to a hight degree (especially is doing something like a .contains() regex-based test. .endsWith() uses a literal string input so my be lest intensive a test, but I think the general principle holds.

If you set the created day note’s $StartDate, then to gave simply do date maths on that. Last 30 days? with a prototype:

$Prototype=="pDay" & $StartDate >= date("today - 30 days") & $StartDate <= date("today")

Without a prototype:

$StartDate & $StartDate >= date("today - 30 days") & $StartDate <= date("today")

In the latter case we’re filtering out any note with a $StartDate of “never”, i.e. no date set (all your day notes should by this point have a $StartDate of the given day.

Does that help?

The idiomatic Tinderbox approach is to make an agent that gathers all the daily notes. That agent’s outline view becomes your index.

2 Likes

Yes, very helpful. Thanks!

  1. I decided that since this is just a yearly task it is just easier to do it manually. When I exploded the list of 2020 dates set the start date to the name of the note.
  2. Thanks for reminding me about AppleScript. It led me to think about using Keyboard Maestro as a solution. Mark’s point about an agent also makes a lot of sense-- I don’t need to have a $text index when I can just collect all of the notes
  3. I collected the last 30 days with this. .
    $Prototype=="Event" & $StartDate >= date("today - 30 days") & $StartDate <= date("today")

I’m attaching 2020 daily notes
daily note v01.tbx (598.6 KB)

2 Likes

I do this somewhat backward, I suppose. I have a Typinator action that opens a dialog box which prompts me for some attribute values that I collect for daily notes. Then Typinator puts all that on the clipboard in .tsv format. I then paste that into Tinderbox, which converts that pasted data into a note populated with the attributes, values, and a name incorporating the current date (which Typinator also provided).

Keyboard Maestro or other could do the same. (It’s not worth DYI AppleScript programming to do this, however.)

Just a keystroke saver, really.

2 Likes