Create Yojimbo Note: Applescript for Apple Mail

My last few postings have all been tech related. Since most of my history related postings are also Asian history related postings, I post those increasingly at Frog in a Well. I’ve been in a hacking mood in the last few weeks, especially since I’ve been working on some new projects at Frog in a Well in my spare time. My last two scripts are essentially shortcuts for creating iCal To-Dos. The first provides a fast way to use Quicksilver to create To-do items without leaving whatever application you are working in. The second provides a way for you to email yourself To-dos that then automatically tell iCal to create a To-Do with content from the email.

The script below is not related to To-Dos but is also aiming to increase my organization a bit. I use a program called Yojimbo (it is a great program but I think the title and its Karate Kid icon are both cheesy) made by Bare Bones, the same people who make BBEdit, the essential text editor for web programmers and coders of all stripes. Yojimbo is a program which keeps snippets of notes, web passwords, serial numbers, and best of all: you can drag and drop any web page you are viewing onto a little tab it keeps at the side of the screen and Yojimbo will download a static copy of the web-page and store it along with all your other notes. Great for when you think you might be away from the internet and want to keep the content handy for later searching.

Sometimes I’m away from my laptop, and as in the case of emailing myself To-Dos that I want created automatically in iCal, there are times I jot down notes from something and want to email myself those notes. It would then be nice for Mail to automatically detect those emails, and create a new Note in Yojimbo with the appropriate title and contents. I hacked together a little script which does just that.

First create a mail filter in Apple Mail that recognizes an incoming email with the prefix “NOTES:”, runs the script, marks the message read and moves it to a folder (in my case called “Reference”). Something like this:

Picture 1-1

The Applescript you can point it to can be downloaded here. The raw text of the Applescript is below:

using terms from application “Mail”
on perform mail action with messages theMessages for rule theRule
tell application “Mail”
repeat with eachMessage in theMessages
set emailsubject to subject of eachMessage
set theContent to content of eachMessage
set emailsubject to text 7 thru (the length of emailsubject) of emailsubject
try
tell application “Yojimbo”
set newnote to (make new note item with contents theContent)
tell newnote
set name to emailsubject
end tell
end tell
end try
end repeat
end tell
end perform mail action with messages
end using terms from

9 thoughts on “Create Yojimbo Note: Applescript for Apple Mail”

  1. Hello,
    I just found your handy little script through an old HawkWings article. I’m using it with Leopard, which seems to work fine, except that it doesn’t read the subject as the note title, but just creates an ‘untitled’ note. Are you aware of a quick fix for this?

    John

  2. Thanks for letting me know. Unfortunately, I don’t have a copy of Lepoard yet, so I can’t test for a fix. Sorry about that.

  3. Thank you for the good writeup. It in fact was once a entertainment account it. Look complex to more delivered agreeable from you! By the way, how can we be in contact?

  4. Hello there! I know this is kinda off topic nevertheless I’d figured I’d ask. Would you be interested in exchanging links or maybe guest authoring a blog post or vice-versa? My site covers a lot of the same topics as yours and I think we could greatly benefit from each other. If you’re interested feel free to send me an email. I look forward to hearing from you! Excellent blog by the way!

  5. I’m not sure where you’re getting your information, but good topic. I needs to spend a while learning much more or figuring out more. Thanks for fantastic info I used to be on the lookout for this info for my mission.

  6. Very great post. I just stumbled upon your weblog and wished to mention that I’ve really loved browsing your blog posts. After all I’ll be subscribing on your feed and I am hoping you write once more soon!

Comments are closed.