Automating summarization of tagged notes

This is likely going to need me to learn AppleScript and figure out further, but … on the off chance that someone out there as done something similar


I have a journal database (this is part of a “can I do it in DT3 instead of Roam” experiment), where I have a group for the year, groups within that for months, and groups within each of those for days.


I’d like to automate “creating a summary note”, within the group for a day (and later, for a month).

If I have individual notes tagged with some particular tag (say #summary or #collect), I’d like to grab “Item links” to them, inserted into a new note (either RTF or Markdown).


If a group contains the note Foo and the note Bar, then this new note would have title containing today’s date, and contents (in the markdown case) similar to

Any ideas? (It almost seems like something that “Smart Rules” can do, but I don’t see a “collection” method there)

Much thanks,

My use case is an overview ToC note for projects, identified by project tag
Here is a extract of my script

tell application id "DNtp"
	set selectedTags to get selection
	repeat with projectTag in selectedTags
		set theNoteName to name of projectTag
		set theSource to ""
		repeat with theNote in (children of projectTag)
			set theName to name of theNote
			set theLink to the reference URL of theNote
			set theSource to theSource & "<a href=" & (theLink) & ">" & (theName) & "</a><br>"
		end repeat
		set newRecord to create record with {name:theNoteName, type:formatted note}
		set source of newRecord to theSource
		set tags of newRecord to {"!Type-ProjectToC", projectTag}
	end repeat
end tell

Thanks, @DTLow, this is a perfect template to build upon.

Also, I was fooling around with various options, and I found a partial solution that doesn’t involve scripting:

  • First, multi-select (either by selecting individual items, or by selecting-all and then deselecting what I don’t want)
  • Then, right-click and select Create Table of Contents, and choose between RTF and Markdown

Caveat: this doesn’t care about tags, so it’s only useful if I want “most of the notes in the group”, but I realized that is usually true.