Export individual HTML files from agent results

Try this:

-- 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 MD files")

tell front document of application "Tinderbox 8"
	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

This is a simple adaptation of the Markdown export script in this thread. It assumes an html export template is configured. Have an export folder ready on your system. Select the aliases gathered by the agent or notes in another container (as opposed to the agent or other container itself; if you do that you’ll get one file) and run. If all goes well the result will be individual .html files in the chosen folder.

1 Like