I finally have time to dig into TinderBox and wanted to use it to manage my notes.
One of things I have been trying to work out, is how to get an agent to automatically save a note to an external file. I have team members who need to see some of my notes and I just wanted to set a Boolean field to true and then the agent to pick that up, and then export the associated note to a directory so that others could see it.
In theory yes, you could use runCommand to create a file whose content is the text of a note. If you need the rich text content of a note the effort would be a bit more complex, but doable. I don’t think you’d necessarily need to use osascript to do this.
This method isn’t precisely the same as “export”.
Doing this in an agent would need to be tested to make sure you don’t inadvently fall into a loop that creates a file repeatedly. Maybe an edict or lower priority agent would be better.
It occurs to me that @pat’s concept here, while different than the OP’s requirement, contains a framework that could be adapted for the purpose of exporting notes to files.
(And I realize that somewhere buried in my archives I believe I worked up a runCommand export-to-file routine once, several years ago, I’ll look for that.)
So you just have to decide what you want to export, and then figure out the how. But runCommand is very useful for this sort of thing.
Yep! As Paul W. mentioned, the Publish from Tinderbox to DEVONthink script uses that technique.
I tried two approaches: 1) building an AppleScript using Script Editor, and then running that file using runCommand, and 2) generating the AppleScript within Tinderbox, and passing it to runCommand. My experience is that the second way works better for passing information to the Script (because we simply embed it directly in the script). Reading command-line arguments and file input from AppleScript has been challenging for me. So while constructing the AppleScript from Tinderbox is conceptually a bit of a mind-bender, it ends up being more effective for accomplishing what I need to.
Anyway, what you want to accomplish should be possible… there are going to be simpler and more complex ways of doing it. So, either go for it or share some more info on what you want to accomplish, and I’ll do my best to share some ideas on how to go about it.
Thank you everyone for your guidance.
I now have a really bad agent that exports the information into a text file.
I coded everything in the Agent since I don’t really understand how to use the HTML template export function.
But your advice helped alot and gave me the inspiration to keep fighting it.
fwiw I really like using action code (agents & stamps) to do exports. Using action code and exportedString (I think that’s what it’s called) you have a lot of control over where and how things get exported. It’s pretty cool.