Is there a way to have DEVONthink append to a file with a rule?

I’m probably way over my head just with the asking, but here’s what I’m trying to do. I use DTTG during the day to leave notes using Siri that are sync’d to my DEVONthink Global Inbox. All good so far. What I’d like to do is automate having those notes consolidated into one text file, where each note name gets one line followed by its note body starting on the next line, and so on. The order doesn’t really matter.

As a bonus, I’d like that file to be appended to a specific markdown file on my hard drive. Can anyone point me in the right direction?

There are some things coming in the next release of DEVONthink To Go that will make this more feasible in iOS.


Thanks. I’ve never looked so forward to after-the-holidays. :slight_smile:

1 Like

If I understand you correctly, you want to consolidate your notes into one markdown file in DT on the desktop?
That would be feasible with a smart rule or a simple script alone. In the latter case you select the records in the inbox and then run the script which

  • defines an empty string
  • looping over the selected records
    • appends the record’s title followed by a new line to the string
    • appends the record’s content (plaintext) to the string
  • finally, append the string to the content of a predefined markdown file

Something like this in JavaScript:

(() => {
let app = Application("DEVONthink 3");
let result = "";
let records = app.selectedRecords();
records.forEach(rec => {
	result += `# ${}\n`;
	result += `${rec.plainText()}\n`; //append more \n to taste
let mdfile = app.createRecordWith({name: "MyMDFile", 'type' : "markdown"});
let p = mdfile.plainText() + result;
mdfile.plainText = p;

You can run it in script editor or in DT after having copied it to its scripting folder

1 Like

@chrillek, yes, that’s exactly what I’m trying to do. My coding chops are rusty, but you’ve pointed me in the right direction. I just spent a little time looking for good starting points for understanding JavaScript syntax. - looks like a good start. Any other suggestions?

Yes. Use AppleScript :slight_smile:



Why’d you want to do that if you can write it so neatly and obscurely in JS? (@Blanc, please do not read any further – more headaches ahead)

(() => {
let app = Application("DEVONthink 3");
let names =;
let texts = app.selectedRecords.plainText();

let mdfile = app.createRecordWith({name: "MyMDFile", 'type' : "markdown"});
mdfile.plainText = names.reduce(function(acc,cur,i) {
    return(`${acc}# ${cur}\n\n${texts[i]}\n\n`)
}, '')