Drafts MacOSX to Tinderbox Integration

I’m a happy user of Drafts. I have recently discovered the very powerful note taking software called Tinderbox, made by Eastgate software.

I’d like to be able to easily transfer notes composed in iOS or on Mac to a Tinderbox Database. I am able to write the AppleScript to create a note in Tinderbox, but it seems that there is not yet enough of the functionality exposed in the Apple Script dictionary for Drafts to get texts and links of drafts via AppleScript (or at least I’ve not been able to figure out a way to access it).

I’d love to be able to transfer quick notes in Drafts to Tinderbox files directly without having to load them to an intermediary file. Please help if you can. I’d also be happy with a Javascript (JXA) solution.

Drafts only supports creation of new drafts via AppleScript at this time.

You would need to start in Drafts. Create a Drafts action with send to Tinderbox using the Run AppleScript action step and run it on your drafts.

If you are needing to batch that, a Drafts action which queries for the drafts and runs the AppleScript action each can be made.

That action could be triggered from outside Drafts using URL schemes to integrate with other flows - but actually querying and working with the drafts library has to start in a Drafts action at the moment.

1 Like

The AppleScript is a work in progress, but have you taken a look at the example in the documentation?

This AppleScript can be run from an AppleScript step and display the sorts of information you are after. You would just need to include these in your AppleScript to create the tinderbox note.

on execute(draft)
	display dialog uuid of the draft
	display dialog permalink of the draft
	display dialog content of the draft
end execute
1 Like

Thanks. Yes I did see this.

There seems one very relevant piece of information, but I don’t understand it, namely:

If the AppleScript defined in the action step returns a result, it will be available to subsequent Script action steps via the context.appleScriptResponses array. Most basic data types, including lists and records, can be returned and will be converted to useable values in JavaScript.

I have a feeling this is the bit that’s tripping me up.

That’s relevant where you want to process the resulting AppleScript output in subsequent JavaScript action steps in Drafts.

I’m not sure it is relevant to what you are trying to do as it sounds like you can do what you have described all in an AppleScript action step.

Maybe consider sharing what you have that is causing you an issue?

Thanks for the clarification. That makes a lot of sense.
Here’s where I am so far. The script executes in Drafts, but no values seem to get passed onwards to Tinderbox. It would be great if I could get this working. Thanks so much.

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
on execute (draft)
    set theName to title of the draft
    set theContent to content of the draft
end execute

-- I should plug in the Drafts values here 
createNote("New Note", "Blah, Blah")

to createNote(theName, theText)
    tell application "Tinderbox 8"
	    tell front document
		    set newNote to make new note at last note's parent
		    tell newNote
			    set name to theName
			    set attribute "Text"'s value to theText
		    end tell
	    end tell
    end tell
end createNote