Automation via Smart Rule or other way?

Hi Community,

I´m trying to copy each new imported document from my central Inbox to a second folder (in this case my Dropbox folder) as I want to make all my newly imported documents available via Dropbox to another person.

I tried different ways but didn´t found the right way? Could someone guide me?

Best,

Marc

Welcome @m.korthaus

  • What have you tried?

  • How are you importing into the Global Inbox?

  • Do you expect to have the documents copied to the Dropbox folder?

Thank you for your question. I’ll import either thru the import folder or via scansnap directly to DT.

I tried to use the smart rules and use some JavaScript or AppleScript, bu I’m not capable to do so by altering what’s already on the forum.

And yes, I’d love to copy (not reference) them in Dropbox

Please post screenshots of your smart rule (trials) and the code of your scripts (trials). “I tried different things, and they didn’t work” doesn’t tell us anything.

  • Do you have just one Dropbox folder you’re sharing with this other person?
    • If so, what folder is it, e.g., Dropbox > Our Project ?

@Bluefrog: yes, Dropbox > Project

@chrillek I want to start over because it just didn´t work. I read through the notes of this thread but that didn´t seem to include a working solution for me (yet) " Folder Action import from Dropbox"

I have suggestion here:

The idea is to create a folder on your computer that you use as an intermediate. For example in your home directory a folder named Import.

We will modify an existing script from DEVONthink to do your required actins.

  1. Start the terminal (You can find it in /Applications/Utilties and issue the following command:

    cp "$HOME/Library/Scripts/Folder Action Scripts/DEVONthink - Import & Delete.scpt" "$HOME/Library/Scripts/Folder Action Scripts/Import & Copy & Delete.scpt"
    

    Note that I’m using this script because it is the most simple. If you intent to have documents send to this folder using other processes like OCR it may be that you are better of with the OCR script of DEVONthink. That script will wait for incremental updates on the file and only start after a stable period.

  2. Create a folder named Import at the location of your choice.

  3. Start the application Folder Actions Setup

  4. Using the + at the bottom add the folder Import to the monitored folder.

  5. On the prompt select the script Import & Copy & Delete.scpt.

  6. Now edit the script using the Edit script button.

  7. This should give you a window like this.


Note the red boxed lines

  1. These lines will instruct DEVONthink to import your file delete the original.

  2. All we have to do is add a line before that will copy it to a folder in Dropbox. Position the following at the green line

    tell application "Finder"
    	set DstFolder to (POSIX file "/Users/myusername/Dropbox/Project/")
    	copy file thePath to folder DstFolder
    end tell
    

    Don't forget to replace `my username` with your user name.
1 Like

Here is a much simpler method…

You can set up a smart rule for the group you’re adding files to in DEVONthink, e.g.,…

  1. Make sure the smart group is targeting the group you’re adding files to.
  2. Only match documents without this tag to avoid re-exporting the same files.
  3. The On Import event trigger activates when you drop files into this group.
  4. Add the tag we want to filter on.
  5. We use a very simple script for the actual export…

In the Finder, select the Dropbox folder you’re sharing. Then with the Option key held, select Edit > Copy … as Pathname. Paste that in the documentDestination line.

So now you just drop files into the group in DEVONthink and copies will be exported to the external Finder folder. Simple :slight_smile:


PS: These are copies of the files. There is no connection with your documents in DEVONthink.
PPS: Yes, there will be a DEVONtech_storage file that is created with the export. These are harmless and can be ignored. But if the person you’re sharing with is also using DEVONthink, they could be used to transport metadata about the exported files.

wow guys, thank you so much, will try today! :pray:

Thank you again for your help, I tried the script and it seems to work, BUT it doesn´t seem to stop, it re-exports the same file over and over until I quit DEVONthink exporting the document to the designates folder (each export add a -1 to the filename).

The Tag is added to the document, but it seems the rule doesn´t seem to stop after its first export. Any ideas?

Thank you so much!

Marc

Is the designated folder indexed in the same database? That could be the cause of your issue, since the exported files match the smart rule criteria too.

Following on from @meowky’s comment, you are targeting the entire database, not a specific group as instructed.

Does that create the problem described? I want to export all files I import, not just a specific group, that´s why.

where I´m able to find what folders are indexed, normally it should only be the “Inbox” folder, right?

Do you have the Dropbox folder indexed in the same database? If so, why if you’re copying files out to the Dropbox folder?

In fact all databases

Ahh, yes: datenbanken. I missed that.

And @m.korthaus, that is even less advisable. Do you really want to export every file in every database? I would strongly recommend you change the Suchen in to a more focused location per my instructions. I would also add a Date Added is This Hour criterion to further restrict the matched items.

1 Like

No, not afaik. Where can I check this?