public
Last active

Import to Day One Journal app from MacJournal Export

  • Download Gist
macjournal_import.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
require "open3"
 
def readfile(file)
 
f = File.open(file)
lines = f.readlines("\n\n\n\n")
lines.each do |line|
fields = line.scan(/\s+Date:\s([^\n]+)$\s+Topic:\s([^\n]+)\n(.*)/m)
 
date = fields[0][0].strip
topic = fields[0][1].strip
text = topic + "\n" + fields[0][2].strip
 
puts date
puts text
puts "-------------------------------------------------------------"
 
Open3.popen3("/Applications/Day One.app/Contents/MacOS/dayone", "-d=\"#{date}\"", "new") do |stdin, stdout, stderr|
stdin.write(text)
stdin.close_write
puts stdout.read
end
 
puts "-------------------------------------------------------------"
end
end
 
readfile(ARGV[0])

Heres a sample text file from a MacJournal export:

Date:   March 14, 2009 3:00 PM
Topic:  Rexburg Idaho

Last night we did

Date:   March 15, 2009 3:00 PM
Topic:  Lazy Sunday

Jana woke up

Can you give us an example of how to run this? Also, what format should I export my macjournal in?

We're working on a fully supported Import function. Sorry I'm not able to assist on this one right now.

any chance there could be a way to import MacJournal (or other) CSV? Not so good at ruby and it seems like it wouldn't be that much work but it could take a while to figure out. :)

We are adding built in Import functions to the next update of Day One Mac.

On Friday, January 6, 2012 at 1:41 AM, gyuen wrote:

any chance there could be a way to import MacJournal (or other) CSV? Not so good at ruby and it seems like it wouldn't be that much work but it could take a while to figure out. :)


Reply to this email directly or view it on GitHub:
https://gist.github.com/977766

Perfect, thank you!

cool. I was able to do it with Excel and Applescript. worked great.

I had some serious issues getting this to work, so I wrote my own in python. See https://github.com/Tam-Lin/MacJournaltoDayOne---Python.

Fantastic, thank you. I'm actually testing our built-in importer for MacJournal right now.

On Tuesday, February 7, 2012 at 6:05 PM, Kevin McKenzie wrote:

I had some serious issues getting this to work, so I wrote my own in python. See https://github.com/Tam-Lin/MacJournaltoDayOne---Python.


Reply to this email directly or view it on GitHub:
https://gist.github.com/977766

The built in importer does not work. It returns: The operation could not be completed. No other information is available about the problem. Can anyone help?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.