Make a journal entry in Day One linked to this document

Day One is a useful light-weight journaling app for OS X and iOS. A command line interface (CLI) is available for Day One users.

Here is a simple script that will create a journal entry in Day One with a notation about a selected document in DEVONthink. Select the document, run the script, enter whatever note you wish, and click OK. Day One uses Markdown syntax, so the new entry is Markdown-ified. The entry has a link-back URL to the selected document in DEVONthink. Journal entries with the link, and sync’d to Day One on iPhone or iPad, will open the document in DTTG if it has been synced from DEVONthink to DTTG.

(* Make a Day One journal entry linked to this document.

Use: select a document in DEVONthink and execute the script

REQUIRES: Day One must be installed on the computer, and the Day One CLI installed

Day One CLI: see http://dayoneapp.com/tools/

*)
property j_Prefix : ""

tell application id "DNtp"
	set theSelection to (the first item of (the selection as list))
	set d_Default to return & return & return
	set j_Header to "## " & j_Prefix & the name of theSelection & return & return
	set d_Prompt to "Notation about " & (the name of theSelection as string)
	set j_Note to text returned of (display dialog d_Prompt default answer d_Default with title "Make a note for Day One")
	set j_Link to "[See document](" & (the reference URL of theSelection as string) & ")"
	set j_Content to j_Header & j_Note & return & return & j_Link
	my makeJournalEntry(j_Content)
end tell

on makeJournalEntry(j_Content)
	
	set new_JournalEntry to "echo " & (quoted form of j_Content) & " | /usr/local/bin/dayone  new"
	do shell script new_JournalEntry
	
end makeJournalEntry

If the Day One CLI is not installed, or is in a different location from /usr/local/bin/dayone, the script will fail silently.

Very Nice Thank you.

Thanks for sharing!

Korm, do you have an idea please how i could automatically import every new Dayone Entry in DTPO?
Thank you