Importing into DT automatically

Hey all,

This is a bit of a question, and related to any tricks anyone has to accomplish this kinda workflow task.

I currently edit a lot of documents in a wiki-style mode in emacs called org-mode. I was thinking that it would be nice to be able to do something like org-publish-dt, and it would export everything as PDFs (or maybe HTML with links or something) and have it import into DevonThink.

I have a feeling that this first part of it wouldn’t be too difficult with Applescript, but the tricky part is with updating the data and pulling stuff out. For example…

Lets say I wanted to do a reimport. If I was to call straight applescirpt like in the first method, my guess is I’d have duplicates of that data. Would there be an easy way, through the use of tags (say I tag my contents in DT as “org”), to remove all the org-related content, then do a total new import.

I would find this fairly helpful anyways.

Another idea that kinda came up is if I exported my org stuff as HTML files into a specific directory, then did an external indexing of those files. My only concern with that is if the files change on disk, are they automatically reindexed or would that be a manual process?

I put this topic in this forum to discuss more workflow on the best way to do this and eventual inclusion of code that’ll hopefully help others with a similar workflow.


Indexing is probably the best solution. You could either use File > Synchronize or attach the “Synchronize.scpt” script to the folder (see folder Extras > Scripts > Examples on downloaded disk image) to automatically synchronize the folder (after selecting it in split/3-pane/column views or opening it in a new wdinow).

Thanks for the reply. It sounds like this synchronize option will also allow for new files to be indexed automatically from DT as well.

I’ll take a look at the other scripts as well as this one this evening and will post the results. The main question I have now as well is how to pull data out of DevonThink - but that may be a bit hard, and really I should question why I’m doing that. I store a lot in org-mode since it has multiple export options, wiki-style editing, and works with git fairly well…so it’s portable among multiple machines. I have a few ideas on how to approach this now that I’m thinking about it more.

Thanks for your help again.


I’m a bit newbieish when it comes to Applescript.

I combined a few scripts together to come up with:

on adding folder items to this_folder after receiving added_items
tell application id “com.devon-technologies.thinkpro2” to launch
tell application id “com.devon-technologies.thinkpro2”
synchronize record this_folder
end tell
end try
end adding folder items to

I don’t really notice it synchronizing anything as a result. Is this because I could be in a different database when it launches, and thus it doesn’t synchronize the folder? The folder name is “body” but the record label in DevonThink is CLHS

The “synchronize” command expects a record but you’ve specified an invalid reference to a folder in the filesystem. In addition, your script seems to be a folder action and therefore requires to be attached to a folder and that the folder’s contents are changed.

Did you have a look at the Synchronize.scpt on the disk image?

Thanks for the reply.

I developed that one script as a result of a folder action script plus this script itself. I copied and pasted the example script to this folder action, and edited one of the files in the directory. Upon doing that, the screen appeared to refresh, but the actual synchronize option didn’t occur. I clicked around and verified the record was correct on disk (in DevonThink it shows correctly). In DevonThink the random text I added to a file does show up.

Upon going to the synchronize menu item, it does alert me that it synchronized correctly and gives me a log message that the item changed.

I also tried to create a new file, “moo.txt” in that directory, and it didn’t get added to the index - either through the synchronize option or the applescript option.

I’ll work with this further and maybe there’s a way I can do this all through a cron job with automator, I don’t know. Ideally I plan to have a few thousand files in a nested folder structure that’s done from some cron jobs that pull data from various sources (mail, news, etc) into a folder structure. Each database would likely have a few references to these external sources. On file additions, removals, or updates, I’d like to have it synchronize with DevonThink in each respective database. That’s kinda the ideal world I’m shooting for right now :slight_smile:

Thanks for your help on all this, I’ll continue to pound away at this and see what I can get working.