Backdate Yojimbo Items

An issue that has recently arisen on the Yojimbo mailing list is that imported items are considered created at the time of import. This is logical, but some people would prefer to retain the creation date of the original file. Enter “Backdate Items,” an AppleScript for Yojimbo that gives you the ability to change the creation date of existing items:

Backdate Yojimbo Items Dialog Screenshot

A word of warning: this script modifies Yojimbo’s database directly using sqlite3. This is quite certainly an unsupported way to manipulate your data. In fact, Apple clearly states that Core Data files like this should not be tinkered with:

While it is easy enough to look under the covers and see what is going on with the XML and SQLite data formats, you should never modify the data in these files yourself.

But I tinker. If you do, too, please back up your ~/Library/Application Support/Yojimbo/Database.sqlite file first. Consider yourself warned that this script could potentially mangle that database.

Download Backdate Yojimbo Items Script 1.2 (11k)

Install the script in ~/Library/Scripts/Applications/Yojimbo/. Usage:

  1. Select some items in Yojimbo’s list pane.
  2. Invoke the Backdate Items script.
  3. Enter the desired date and time in any supported format.
  4. Click “Creation” or “Creation & Modification” to reset the corresponding timestamps.
  5. Changes will not be visible until you restart Yojimbo. You may backdate more than once before restarting Yojimbo, but don’t edit a backdated item until you’ve restarted Yojimbo or your changes may be lost.

Examine the script for more information about how it works. The SQLite Database Browser can also be used for this purpose, but you’ll have to manually convert dates to seconds since January 1, 2001 00:00:00 GMT (the NSDate epoch). With any luck, the option to preserve creation dates will eventually be added to Yojimbo’s import facility and this hack can be retired.

Posted on Monday, May 7th, 2007. Tags: , , .

4 Responses to “Backdate Yojimbo Items”

Posted by Jim on Tuesday, May 8th, 2007 at 11:31 AM.

The 1.1 update adds better error checking for invalid input dates.

Posted by Jim on Friday, May 11th, 2007 at 10:54 AM.

To automatically backdate imported items with the creation and modification dates of the original files, see this script’s companion, Backdate Import.

Posted by Johnnie Wilcox on Sunday, January 17th, 2010 at 2:05 PM.

Thanks for this utility which, unfortunately, I have not been able
to use. AppleScript (OS X v.10.6.2 on a Mac Pro) reports “Invalid
date and time date 01:59:59 of «script».” Any chance you can repair
the above issue? Even if not, thanks for considering and for making
this code available. (My ultimate goal is to use your SQL-fu in a
small script I’ve written that pulls a specific date from a Yojimbo
item’s “Comments” field and uses that date to backdate the item.)

Posted by Jim on Sunday, January 17th, 2010 at 7:34 PM.

Hi, Johnnie. I haven’t used the script in a while, so I just gave it a try to confirm that it doesn’t work in 10.6.2. According to Activity Monitor, it was hanging in the call to zdump. That part of the code was lifted from other examples, so I’m not sure exactly how to fix it.

However, the good news is that most of that code is just dedicated to adjusting the time part of the item timestamp correctly based on past daylight savings changes. So, if that is not a key concern, you can sidestep the problem by replacing the entire contents of the ConvertToGMT function with “return _inputDate – (time to GMT)”, which is already present as an [unfortunately ignored] error case.

Hopefully that fix will be useful for your project. I suspect there’ve been changes to the OS time zone/DST database which were sufficient to confuse the relatively fragile command line that pulled info out of it.