« The Sadism of American Waterboarding | Main | Instant Gratification: Saving Web Bookmarks Everywhere Using Yojimbo, AppleScript, and MobileMe »

Saving Web Documents Everywhere Using Yojimbo, AppleScript, and MobileMe

As a former academic and currently unaffiliated researcher, I feel fairly compelled to meticulously and comprehensively document my reading, including my online web reading. Years ago, I made the shift to RSS and began using client-side bookmarking software and Delicious to compile the history of the web items I encountered. The problem with such a system? Link rot.

Despite owning a license to Yojimbo 1.0 since January 2007 when Tinderbox licenses began including a license for Yojimbo, I didn’t use Yojimbo. Adding items manually to a database app» defeats the whole purpose of quick additions to a repository. I was also uncomfortable with the idea of having a database tied to single machine and I hadn’t yet begun taking advantage of MobileMe syncing.

My interest in Yojimbo picked up when I began considering tag-based filing systems. My results were uneven, and I came to the conclusion that I wished OS X had a database filing management system built in. (Yeah, my hopes were dashed when Apple scrubbed their plans for ZFS.)

In late fall of last year, I started playing earnestly with Yojimbo and in mid-January of this year I imported all two-thousand plus of my Delicious bookmarks into Yojimbo». Over the next few weeks, I infrequenly used Yojimbo to store new data, so strong were my filing habits.

It wasn’t until March that I realized I could get away from the software that had been plaguing me as well as solving the problem of link rot slowly transforming my carefully curated bookmarks into a steaming heap of 404s: I could use Yojimbo to store PDFs of those web pages that interested me.

In my free time I developed two collections of AppleScripts that help me archive PDFs to Yojimbo: 1) Add to Yojimbo and its companion PDF service, Save PDF to Yojimbo and 2) Yojimbo Collection From Front Window and its companion PDF service, Save PDF to Yojimbo Collection.

Both Add to Yojimbo and Yojimbo Collection From Front Window contain substantial comments that explain how they work. Of the two scripts, I think Yojimbo Collection From Front Window is the more potentially useful. Yojimbo Collection From Front Window creates a new note item and a PDF archive item for every open tab in Safari's frontmost window and adds them to a new folder collection. I use it to collect multi-page web articles into a single Yojimbo collection, to collect and associate web pages for later reference, to collect an article and its expanded images into a group, etc. Both scripts allow for on-page text selections and will save those selections to the newly created Yojimbo items’ “Comments” sections, this along with other metadata including tags, URLs, and user-supplied notes.

In-Code Preamble for Yojimbo Collection From Front Window

Tinkerers and AppleScripters will want to look inside to see the features and shortcomings of my scripts».

The rest of us will want to put the PDF services (the files with “PDF” in their titles) in ~/Library/PDF Services and assign a keyboard shortcut to those services. To use my scripts out-of-the-box, those shortcuts should be Control-Option P for Save PDF to Yojimbo Collection and Command-Control-Option P Save PDF to Yojimbo. I restricted these keyboard shortcuts to the applications in which I expect to invoke my scripts, namely, Safari and NetNewsWire.

Keyboard shortcuts for PDF Services

The next step is to save the main scripts somewhere where you can get at them. I keep mine in ~/Library/Scripts/Yojimbo/Add to Yojimbo.scpt and /Users/mrsquid/Library/Scripts/Safari/Yojimbo Collection From Front Window/Yojimbo Collection From Front Window.scpt. I then assign keyboard shortcuts to these AppleScripts using Keyboard Maestro. The shorcuts for these scripts aren’t restricted by my AppleScript code.

The main shortcoming of my scripts is that they script the GUI, which means that whichever app you’re saving PDFs from must remain frontmost until the script has done its work». One of the main features of these scripts is that they both can be set to run with zero user-input (read the comments) and they also allow users to return to previous stages to modify tags, comments, and other metadata.

Keyboard jockeys keep in mind that Command-Return triggers the default button for multi-line text fields in AppleScript.

Use Command-Return to Trigger the Default Button from within Multi-line AppleScript Text Fields

Use Command-Return to Trigger the Default Buton from within Multi-line AppleScript Text Fields

end of article



I updated Add to Yojimbo and revised these scripts to send bookmark items, instead of PDFs, to Yojimbo.


Thanks for sharing the scripts, they will be quite useful.

May I ask what your process was to import bookmarks from delicious? I hope to do the same thing. Any clues would be most welcome.