Jump to content

pdxmph

Level 1
  • Posts

    4
  • Joined

  • Last visited

Everything posted by pdxmph

  1. You just need to grab the "date sent" attribute when you look at the original note, then add it as the "created" property to the newly created Evernote item. The AppleScript version: tell application "Mail" set theMessages to every message of the mailbox "NoteMigrate" repeat with thisMessage in theMessages set myTitle to the subject of thisMessage set myText to the content of thisMessage set myCreateDate to the date sent of thisMessage tell application "Evernote" create note with text myText title myTitle notebook "Imported Notes" tags "imported_note" created myCreateDate end tell end repeat end tell The Ruby/rb-appscript version: #!/usr/bin/ruby require 'rubygems' require 'appscript' include Appscript en = app("Evernote") mail = app("Mail") notes_folder = mail.mailboxes["NoteMigrate"] messages = notes_folder.messages.get messages.each do |m| en.create_note(:title => m.subject.get, :notebook => "ImportedNotes", :with_text => m.content.get, :tags => "imported_note", :created => m.date_sent.get) end
  2. Well, it was pretty easy in AppleScript, too, since I had some scrap code from a while back. Same deal as before: Drag all the notes into a new mailbox called "NoteMigrate." No error checking or anything. Worked for me: tell application "Mail" set theMessages to every message of the mailbox "NoteMigrate" repeat with thisMessage in theMessages set myTitle to the subject of thisMessage set myText to the content of thisMessage tell application "Evernote" create note with text myText title myTitle notebook "Imported Notes" tags "imported_note" end tell end repeat end tell
  3. This is very easy in Ruby using appscript. The main point is, the notes have to be dragged into a new mailbox. For whatever reason, the Notes "folder" doesn't exist where Mail's scripting is concerned. In this example, I made a new mailbox called "NoteMigrate" so it appeared under "On My Mac." The script will create a notebook called "ImportedMessages" if you don't have one already, and it will tag each note with "imported_note." The first line of a given note is the 'subject.' All the lines of a note, including the first, are the content. #!/usr/bin/ruby require 'rubygems' require 'appscript' include Appscript en = app("Evernote") mail = app("Mail") notes_folder = mail.mailboxes["NoteMigrate"] messages = notes_folder.messages.get messages.each do |m| en.create_note(:title => m.subject.get, :notebook => "ImportedNotes", :with_text => m.content.get, :tags => "imported_note") end I don't do much scripting with Applescript directly because I got more fluent with Ruby using rb-appscript much more quickly. The logic is so straightforward I'm sure an adept Applescripter will be able to translate it. If nobody shows how in a day or two, I'll do it.
×
×
  • Create New...