Script to pipe emails into Yojimbo

YojimboJim Correia of Bare Bones Software has posted a script to the Yojimbo mailing list that will pipe a selected email from Mail.app into Yojimbo.

This is handy (a) if you use Yojimbo and (b) like me, you find it a bit of a pain to import emails with the “Save PDF to Yojimbo” option in the PDF section of the Print dialog.

The script will import the contents of the email and the sender, subject and date into a new Yojimbo note:

Mailtoyojimboscreenie

You can copy the text here:

on generateMessageText(m)
tell application “Mail”
set _sender to sender of m
set _subject to subject of m
set _date to date received of m as string
set _contents to content of m
set _messageString to “From: ” & _sender & return
set _messageString to _messageString & “Subject: ” & _subject & return
set _messageString to _messageString & “Date: ” & _date & return
set _messageString to _messageString & return & return & _contents
end tell
end generateMessageText

on run
tell application “Mail”
tell message viewer 1
set messageList to selected messages
set _name to subject of item 1 of messageList
set _contents to “”
repeat with m in messageList
set _contents to _contents & my generateMessageText(m)
end repeat
tell application “Yojimbo”
make new note item with properties {contents:_contents, name:_name}
end tell
end tell
end tell
end run

Or use this pre-complied version. Save it into the same place as the rest of your mail scripts, maybe give it a keyboard short-cut with FastScripts Lite or set a Quicksilver trigger for it or attach it to a Mail Act-on rule, and you’re done.

Nifty. A big thanks to Jim.yojimbo, mail.app, apple mail, applescript, script, importing messages, productivity, shortcuts

Similar Posts:

Tags: , , , , , , ,

9 Responses to “Script to pipe emails into Yojimbo”

  1. Leslie says:

    Thanks for the Yojimbo and Mail-act tip. It works great!

  2. Marc says:

    This is very cool. Thanks for the link to the script.

  3. Hawk Wings » Blog Archive » Hawk Wings Addon and Plugin List Update: 10 new entries says:

    [...] Mail to Yojimbo (script to pipe emails from Mail.app to Yojimbo) was added to the Integration with other apps section. [...]

  4. Hawk Wings » Blog Archive » Yojimbo 1.3: Tagging, hyperlinks and more says:

    [...] Perhaps I should also mention that Yojimbo users who also use Mail.app will get a lot of mileage out of an applescript that pipes selected emails into Yojimbo. I use this a lot. [...]

  5. Alex says:

    Any idea on how to make this script work with non-Latin based mails? My Cyrillic mails get their subject, from and date entered correctly in Yojimbo, but the actual content of the message gets transferred as mumbo jubmo. I tried changing “as string” to “as Unicode text” in the source, but that didn’t do the trick. If anybody has an idea, please share.

  6. Bruce Garlock says:

    Thanks for the script – I use it with Mail Act-On. It is a great time saver for me.

    Take care,

    Bruce

  7. Doug Ransom says:

    I get an applescript error

    Yojimbo got an error: Can’t make application “Yojimbo” into a type specifier on the
    make new note item with properties {contents:_contents, name:_name}

    line.

  8. Mac PIM review II: Yojimbo review | View from the Dock says:

    [...] app (i.e. Mail). To get the actual email message text into Yojimbo, you can use this free AppleScript created by a Yojimbo developer (I use it in concert with [...]

  9. Mike Wallbridge says:

    I am completely new to AppleScript. I copied the text above and pasted into AS and pressed “run” but it didn’t work and I have no idea what to do with the pre-compiled version. Can anyone tell me in very simple terms what to do?

Leave a Reply