Tinderbox and Drafts (getdrafts.com)

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
5 Likes