Hazel to Yojimbo including Encrypting File

First off, you'll get a lot of great content form macsparky.com.   So check over there for really good tips.  The Mac Power Users podcast got me much more functional on the whole productivity in a Mac world so check that out as well.

This post is about getting an Applescript to use in Hazel to drop items into Yojimbo including encrypting and OpenMeta tags.  I programmed as a kid (Basic on C64, Commodore Pet,...) but have little experience on the Mac side since getting an iMac a couple years ago.

First, why Yojimbo and not simple file/folder?  I use Yojimbo because I like the ability to encrypt certain documents (like Bank Statements) and still have the documents searchable in spotlight.     The other solution was an encrypted disk image but it was only searchable after the image was mounted with the password.  The watch-out for using a program to organize your files is having to get them out later or the upgrade path being locked in.  Its easy to grab all items and drag them out of Yojimbo to a folder where I'm guessing I could cobble together some hazel rules to sort them out via the open meta tags or simple title and content rules like used to dump them into Yojimbo.

Versions of Programs:  Hazel (version 3.0.12), Yojimbo (version 3.0.4 (260)), AppleScript Editor (version 2.5 (138)) - you don't really need Applescript Editor but I used it to test out how to make this work.

This seems like it should be trivially easy but I always had a problem until I added a line in the front: set this_file to theFile.  I'm not sure why.  So here is the script.  The encryption piece was relatively easy simply using the last PDF archive item.

AppleScript to embed in Hazel for import and encrypt in Yojimbo

Hazel rule where the AppleScript is embedded

And the script:

set this_file to theFile

tell application "Yojimbo"

import this_file

encrypt last pdf archive item of the library

end tell