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!
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.
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:
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.
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.
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
I collected the last 30 days with this. . $Prototype=="Event" & $StartDate >= date("today - 30 days") & $StartDate <= date("today")
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.)