Hi @Gernot I’m glad we had our call. I know have a better understanding of what you need.
You are actually asking for two things, 1) apply a unique template to each note before export, and 2) export each child of an agent as a separate note.
For thing 1, the example above works perfectly.
For thing 2, at this time Tinderbox does not natively have a function to export a container’s notes, e.g., agent’s notes, as individual files, it packages them all up and exports them as one file. There has been a request for this capability in Backstage. For the time being, the way to export each file as an individual file is to use the following apple script.
-- Have an export folder ready. Select Tinderbox notes and run.
-- NB. Will overwrite existing files of same name.
set theFolder to (choose folder with prompt "Choose a folder to receive the exported HTML files")
tell front document of application "Tinderbox 9"
repeat with aNote in selections
tell aNote
set theFilePath to POSIX path of theFolder & (value of attribute "Name") & ".html" -- name file after note
set theHTML to evaluate with "exportedString(this,$HTMLExportTemplate)"
do shell script "touch " & quoted form of theFilePath -- create file if doesn't already exist
do shell script "echo " & quoted form of theHTML & "> " & quoted form of theFilePath -- write to file
end tell
end repeat
end tell
Attribution: @sumnerg wrote this script, see here: Export individual HTML files from agent results - #7 by sumnerg.
What you do is you select all the notes in the agent the then run the AppleScript. The script will ask you where you want to save your files and then it will process each file individually and export them.