Tinderbox Forum

Tinderbox and Drafts (getdrafts.com)

Now that there’s a pretty solid macOS version of Drafts (https://getdrafts.com/), I’m wondering if anyone has has any experience with Drafts and Tinderbox integration?

Drafts provides similar scripting chops to Tinderbox, and also creates UUID for each individual Draft in its storage. It seems a natural place to start notes for Tinderbox, using the great iOS version of Drafts, which can then be exploded or split into a glut of Tinderbox notes on the macOS side.

Before I sacrifice a vast quantity of time into this rabbit hole, I’m wondering if braver people than I have stepped in there already?

1 Like

In the sense that Teslas are like tricycles, I suppose :slight_smile:

There are numerous scripts already posted here by @trewr and others that could easily be incorporated in a Drafts action.

I haven’t looked at macOS drafts, but my impression (perhaps out of date ?) was that it didn’t include the JavaScript actions of the iOS version.

Has that now changed ?

( TaskPaper has a richer JS interface, including programmatic access to outline structures and key-value pairs – both of which make it a very useful adjunct to Tinderbox )

Hey Rob,

Yes, it’s changed, quite significantly. The JS model from iOS drafts has made it to the macOS version, and even the drag-and-drop automation has been ported over, naturally with limits where iOS features don’t have macOS parity. Coupled with the impressively fast syncing, it’s quite a powerhouse; it looks like it’s almost itching for the kind of Tinderbox integration that DEVONthink enjoys, particularly as it seems so much better a place to pull text from (and maybe even push to) than Simplenote or Apple Notes - even more so for Tinderbox, as it’s otherwise a plain text environment.

Might be worth another look if you’ve been away for more than six months; it’s a really impressive system, but requires a subscription for full action editing access.

3 Likes

The following AppleScript-based Drafts action will send notes from Drafts to an inbox folder in a TBX file. Tags in Drafts.app are transferred to $Tags in TBX.

-- incorporate this script in a 2-step action in Drafts.app. The action must be initiated from a note in Drafts.app with selected text that will become the $Name of the TBX note. 
-- the script is the 2nd action. The first is a Clipboard action to push SelectedText into the clipboard

on execute(draft)
	set theFile to "/path/to/TBX/file/filename.tbx"

	set theTitle to the clipboard
	
	set theBody to the content of the draft
	set theCreateDate to ("" & createdAt of the draft)
	set theModifyDate to ("" & modifiedAt of the draft)
	set theTags to (tags of the draft)
	set theListOfTags to convertListToString(theTags, "; ")
	
	tell application "Tinderbox 8"
		open theFile
		
		tell front document
			set theContainer to note "inbox"
			set myNote to make new note with properties {name:theTitle} at theContainer
			tell myNote
				set value of attribute "Text" to theBody
				set value of attribute "Created" to theCreateDate
				set value of attribute "Modified" to theModifyDate
				set value of attribute "Tags" to theListOfTags
				set value of attribute "KeyAttributes" to "Created;Modified;Tags"
			end tell
		end tell
	end tell
	
end execute

on convertListToString(theList, theDelimiter)
	set AppleScript's text item delimiters to theDelimiter
	set theString to theList as string
	set AppleScript's text item delimiters to ""
	return theString
end convertListToString
4 Likes

Nifty!

I would love to see tighter Drafts integration with Tinderbox along the lines of what DT3 can do. I suspect it would require a much richer AppleScript library, but I can talk to Drafts’ developer about that. (“Watch Drafts Workspace” would be freaking amazing)

1 Like

Yes please!

Having some way of designating a channel for notes from Drafts to get into Tinderbox would be very useful.

I don’t know what form this would eventually take, but e.g. being able to say “this TBX doc will watch for Drafts tags matching #foo”, etc. would be one way.

Drafts is on my menu bar in iOS, and has a global shortcut on my Mac. It’s exactly what the the website proclaims: where text starts. It’s by far the best tool I’ve found for quickly jotting an idea - launch the app, and a blank note pad is waiting. I use it all day, every day.

Getting stuff out of Drafts, I do the simplest way possible: I copy the text from Drafts and paste it to where it needs to go. I’ve experimented with the export options but found I just never needed them. Experience has shown me that moving text from Drafts to other apps is not the bottleneck. Drafts neatly solves the problem of “where do I put this thing?” and from there I treat it like an ordinary inbox, working through it sequentially and doing my work in other apps.

1 Like

midas0441Thanks for this. As I’m new to AppleScript and drafts it took me a bit to figure this out. For those that are also new, here are the steps that I took.

  1. Download drafts
  2. Join the 7 day free trial (afterward: $19.99/year or $1.99/mon) so that I could try the script
  3. Open drafts and create a first draft, e.g. body “My first note”, add a couple of tabs, e.g. TBX and Test.
  4. Select Managed Actions… option from the Actions menu in drafts
  5. Click the “+” button on the button left to create a new action group, name it “Add to Tinderbox”
  6. Click the “+” button on the right in the Actions list and name it “Send to Tinderbox”
  7. Double click on “Send to Tinderbox” to edit it
  8. In the bottom middle of the screen, under Steps select “Clipboard” and then the + button
  9. In the bottom middle of the screen, under Steps select “Run Apple Script” and then the + button
  10. Paste the AppleScript from the forum post to the Script field in Drafts
  11. Find you Tinderbox file in you Finder. Click on it. On the bottom of the Finder look at the path, rt. mouse click on the file name and click “Copy ‘[FileName]’ as Pathname”
  12. Paste the path into the AppleScript in the “set theFile” line
  13. Open Drafts and select Show Action list form the View menu
  14. In the search bar search for Tinderbox
  15. Click on the note you want to send to Tinderbox and double click on the action “Send to Tinderbox” action you create (the first time macOS will ask for permissions)

You’ll hear a beep and the draft note will have been added to your Tinderbox.

1 Like

Just have Drafts put the note on the clipboard, then paste it to the Outline.

(I’m always harping on the fact that scripting is often the sledgehammer approach to solving problems – explore the simpler options first. In the case, above, someone would have to modify – and test, always test – the script for each new document. )

1 Like

Paul, you’re right in that this will work for the drafts note body, but it is not clear to me how the process could work for populating the tags, title, and other attributes. Perhaps the Drafts templated to make this work. Not sure.

I didn’t say it would.