Scripts for migrating from Mori to DEVONthink Pro

I have migrated from a Mori database with a couple of thousand items. The history of them goes back to Hog Bay Notebook by Jesse Grosjean in early 2004 (and before that from Classic EZNote). I exported from Mori as a nested folder hierarchy of RTFD, since I found that to be the only working method to get the stuff in with reasonable quality and structure into DEVONthink Pro.

However, there were a large number of issues that needed to be corrected, and I have spent a few days writing scrips to fix that. It was hard work but has worked well. I have now completed my transition from Mori to DTP.

I am posting this simply to offer these scripts to the DEVON community. I can’t see any place at devontechnologies where I can upload these scripts!? Is there some place?

Maybe I am the last person on earth to finally leave the sinking and now dead corpus of Mori. So I don’t know the degree of interest in these scripts. I am absolutely not going to maintain them or support them in any way whatsoever, but I offer them completely free to anyone who can use them and possible adapt them to your special needs.

Some of the scripts are fairly complicated, and there appears to be severe bugs in the implementation of DEVONthink’s AppleScript support, so there are some weird things that forced me to basically do cut-and-try until it worked. Most of the bugs I ran into dealt with attribute runs (see comments inside the scripts).

There are 5 scripts:

  1. Strip the “.rtfd” from the names (titles) of all rtf(d) files.
  2. Restore the name of those RTFD files whose name had the string ": " in Mori but on export became "/ ".
  3. Re-link all links in RTFD files that point to files in the same group (folder). (And it also removes bogus links in linefeeds.)
  4. Re-link those links in RTFD files that point to files that reside in other groups.
  5. Fix dead web link URLs, i.e those that had an attribute run such that they looked almost like live URL links, but in practice they were dead since the link was just gone (missing value in AS parlance). (I don’t know the origin of the problem, maybe some files simply got corrupted a long time ago, since these links were dead also in Mori.)

In my case, a total of 746 links were changed (plus 39 bogus links removed)

There are long comments inside the scripts.
And the attachment (zip archive) includes a small rtf file with a bit of documentation.

Since I do Objective-C development, I wanted to use some nifty methods of NSString, so 4 of these scripts are AppleScriptObjC Explorer scripts (file extension asobjcexdoc). The program AppleScriptObjC Explorer 2 is made by Shane Stanley and can be downloaded and purchased here: … lorer.html It’s a great program! Strongly recommended! (36.1 KB)

Thanks, Harald. I was just thinking about ASOC this morning. Nice to have some more reference material to look at. Cheers! 8^)

Just a short note to those who do not have AppleScriptObjC Explorer, but still want to use (parts of) the scripts or just have a glimpse at them:

Each script file is a package, and if you open the package you will find the files:


Just open main.applescript in AppleScript Editor or the rtf in TextEdit.

There is just one place where I have called a method of NSString, and if you want to run the script in AppleScript Editor instead, you will have to replace the Objective-C call to NSString with your own routine. It’s not difficult, but using the NSString method directly is so much easier, since AppleScript itself is very weak in string processing.

Alternatively, you can export the script as an applet (an application) and run it almost as is, since AppleScript in MacOS 10.7 can run AppleScript ObjC applets (but not regular scripts). However, the support is very limited — there is no logging, which makes debugging especially tedious. Possible, but not recommended. You can read more at