Skip to content

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

{ 6 } Comments

  1. john chandler | 2007.11.19 at 15:35 | Permalink

    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. Muninn | 2007.11.19 at 18:27 | Permalink

    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. Emanuel Westenhaver | 2011.2.5 at 22:17 | Permalink

    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. group uk edinburgh | 2011.9.28 at 11:44 | Permalink

    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!

{ 3 } Trackbacks

  1. [...] Konrad Lawson has written an applescript which will cleverly pick out the text of an email you have sent to yourself and use it to create a note in Yojimbo. [...]

  2. [...] Here’s what task capture rule in Mail.app looks like: The MailAction.applescript pictured is included with OmniFocus. With this rule, any email that comes to the ToDo POP account is automatically passed along to my OmniFocus inbox to be processed. The rule for Yojimbo looks identical, except that is is for my Yojimbo POP account, and runs a script that I found here. [...]

  3. [...] The application works perfectly, and it’s a great addition to Yojimbo, whose developers don’t will to open up to external services by now. (Just to let you know, I’d love to have my Instapaper stuff into Yojimbo). Fortunately, there are a lot of user created Applescripts ready to be downloaded, just search on Google for the one you need. For instance, I’ve set up two Applescripts with FastScripts: Send Mail to Yojimbo (from Shawn Blanc) and another one which, in combination with Mail.app rules, sends mail messages to a specific Yojimbo folder. [...]