Exporting automatically to Finder folder

Dear all,

Because I am very new to both DEVONthink Pro Office and automation, I have spent the past couple of days trying to find a way to export automatically all the files in my Global Inbox to a Finder folder. So far, success has eluded me, so I was wondering whether someone could be so kind to help me figure it out.

So far, I have created an Automator Workflow that starts by launching DTPO and opens the Global Inbox, and ends by exporting records to a specified Finder folder, closes the Global Inbox and quits DTPO. The part I realize I am missing, and which I cannot figure out, is how to feed all the files in the Global Inbox to the Export Records action.

Thank you for your consideration.


Where are you trying to export them, and also why?
What’s the purpose of what you’re trying to do?

Thank you for the prompt reply.

I am trying to export those files automatically to a local folder on which Hazel will apply a rule: if Hazel will find certain keywords in the text of the files exported from DTPO’s Global Inbox, Hazel will move those files to a second folder, on which other end rules will be applied; if Hazel will fail to find those keywords in the text of the files exported from DTPO’s Global Inbox, Hazel will move them to a third folder, on which another set of end rules will be applied. Does it help or would you need more details? if so, please let me know which ones: I will be happy to supply them.

Thank you for your consideration.

Best regards,

No problem. So you want the files moved out of the Global Inbox, ending up with files in the Finder but the Global Inbox empty?

Dear Jim,

Thank you very much again for such a prompt reply. Yes, you are right: that’s exactly what I am trying to do. Please consider that I thought I would use an Automator workflow simply because of all the actions that already come with DTPO, but I would be happy to do it differently if you thought there is a simpler way to do it. If it helps, I also have Keyboard Maestro at my disposal. Once again, thank you for time and consideration.

Best regards,

While what you’re doing seems a little odd, I have written a triggered script that will do what you want.

  1. Unzip the attached file.
  2. In the Finder, press Command-Shift-G and paste: ~/Library/Application Support/DEVONthink Pro 2/Scripts
  3. Drag and drop the AppleScript from Step 1 into the Triggered folder in this window.
  4. Double-click the script to open it in Script Editor. You will need to enter the proper path for your situation for the destinationFolder variable.
    Hint: If you drag and drop your Hzel-watched folder into the script, it will prompt you. Answer Alias and the path will be pasted in.
  5. Relaunch DEVONthink Pro (Office).
  6. Select a group you want to use for the script. This will not work on the database itself, so make a group to put files into.
  7. With the group selected, select Tools > Show Info.
  8. Next to Script, press the Select button (you can use the same command from step 2 to jump into the proper folder) and add the triggered script to the group.
    A little script icon will appear to the right of the group’s name in the database.

Now when you select that group, all the contents should be exported to the destination folder you specify, then the files will be put in the database’s Trash (which you should periodically empty). It also logs a message in Window > Log about each item it exports.

No, this will not be “automatic”, ie, it’s processing behind the scenes with no user intervention. You must periodically select that group to trigger the script.
Export and Delete.scpt.zip (4.63 KB)

1 Like

Dear Jim,

I really don’t know how to thank you! That’s awfully gracious of you! Thank you so very much!

I will not have access to my Mac until tonight, but I will try your AppleScript as soon as I get back and will let you know.

DTPO is an amazing piece of software, but as all the enterprises that move in uncharted territory, it is plastic, in continuous evolution and therefore never “perfect”, so the support you, DEVON and the users in this forum provide is not only notoriously outstanding but critical, and frankly a key component of my decision — and I am sure that of many other users’ — to purchase the software. So thank you very much for that.

Best regards,

You’re very welcome. We built DEVONthink to be logical, robust, and very flexible. This includes the ability to extend and customize the app’s functionality via AppleScript, etc., making it an even more capable “assistant” in peoples’ work and lives!

Dear Jim,

I have just tried your script and it works like a charm! Thank you very much again for your time, patience and help.

Best regards,

You’re very welcome. Have a great weekend! :smiley:

Thank you, Jim; you too!

Best regards,

Hi Jim, can you please share this script so that I can move files within a selected group to a Dropbox share folder held by my clients?
Regards Brett

Welcome @bancoora

Are you using DEVONthink 2.x still?
If so, we highly suggest you move to DEVONthink 3. It’s no mere upgrade, but a leap forward, especailly regarding automation options.

Hi Jim, currently using DEVONthink 3.0.2

Bearing in mind, much of the functionality of triggered scripts can now be done with smart rules, here is information on them from the Help > Documentation > Automation > Triggered Scripts…

Here is the script (which I just tested works as expected in DEVONthink 3). Also note the script is editable (and commented) as you will need to set your own destinationFolder variable in the script:
Export and Delete_tr.scpt.zip (4.8 KB)

Here’s an example of a smart rule that can do the same essential thing…


Thanks very much Jim! - this works nicely! very much appreciated…

You’re welcome :slight_smile:

Hi Jim, created the SmartRule also - this is perfect! - thanks again…

You’re welcome. Note you only need one of the other, though it’s technically feasible to use both on the same targeted group. Hmm…


Thanks Jim, I’m using the SmartRule alternative - now I just need to figure out how to get a smart-rule to do my all work while I sit back watching it all happen…