auto import files from folder on my harddrive

Hi there,

I am new to Devonthink, and have a question.

I take most of my notes in .txt or .doc files, and store these in a few folders in my harddrive. Is it possible for Devonthink to scan these folders and add all new files to my devonthink database automatically?

best

Martijn

Yes, if you are using DTP or DTPO, look in the ‘Extras’ folder on the disk image. There are two folder action scripts (one for import, one for index) that will do what you want.

1 Like

@Greg: Thanks! it works, I appreciate that!

New files appear in the Devonthink ‘inbox’. Now do you know if there is also a way to automatically place them in devonthink folders? My devonthink folders have the same name as the folders in the finder.

best

Martijn

I suppose you could hard code each script to import or index the files to a specific folder in DTP, however you are asking the wrong person how to do that. I’ve never explored the scripting to see if/how that could be done. I would rather have one script to do it all as in the past, any time I’ve hard wired something like this, it always breaks with some upgrade to the application or the OS.

I can tell you what I have done with the folder action script that works well, but I think I will need to wait until the next public beta is released to discuss it. If I recall correctly, the workflow requires a change that was made in the latest closed beta version.

Now that pb4 is out, here’s what I have done with the folder action import script. There may, probably are, better ways to do this but I like how it works.

  1. In DTP or DTPO pb4, set the preference for ‘Import>Destination’ to ‘Select Group’
  2. Open the ‘Action Import’ script in the ‘Extras’ folder with your preferred script editor
  3. Change the line:

tell application id "com.devon-technologies.thinkpro2" to import thePath to incoming group

to:


tell application id "com.devon-technologies.thinkpro2" to import thePath to ""

  1. Save and attach the script as a folder action to the folder you want to use to import files in the Finder to DTP

When you drag a file to this folder, you’ll be presented with a dialog like this one to set the destination:

The dialog will present you with the folder structure of all the open databases in DT or, if DT is not open, with the folders of your default database.

That’s helpful, but is it possible to automate this into a defined folder of a defined database, now that in 2 we can have multiple open databases?

The following, for example, doesn’t work:

...
tell application "DEVONthink Pro"
    set result to open database "~/Desktop/IPT.dtBase2"
end tell
...
tell application "DEVONthink Pro" to import thePath to "/Inbox"
...

It imports into the currently active database regardless of what I specify in “set result to…”.

Just resurrecting this one. The post by Greg_Jones almost does what I need, but not quite.
I’m successfully using the Folder Action “Action Index.scpt” to index files I drop into a particular (Finder) folder. All the files then appear in my database Inbox, which I’ve set as the default (DTPO) folder.

What I would like is to set up some other (Finder) folders which will do the same, except automatically index the files to a different target (DTPO) folder in DTPO. Greg’s modification to the folder action lets me choose the destination, but I don’t want to have to do that each time, I want there to be a consistent destination for each given (Finder) folder I’m dropping files into.

I realise that means I’ll need to make multiple copies of Action Index.scpt, one for each (Finder) folder, with the target (DTPO) folder changed in each one. My question is, how do I specify that target folder? (Bearing in mind I’m a total Applescript novice). Is it the format specified in ‘Location’ when I click Get Info on the desired DTPO folder?

[Edit - tried that, and it doesn’t seem to work - still goes to the Inbox. The line modified in the script was:
tell application id “com.devon-technologies.thinkpro2” to indicate thePath to “ORAC > HO Correspondence”
where ORAC is the name of my database and HO Correspondence is the name of the DTPO folder I want the files to be indexed to.]

If you are indexing, rather than importing, your documents then there is a simple solution. Just index the Finder folder(s) to the database and attach the Synchronize script (using the DT info panel) to that folder. If new documents are added to the folders in the Finder, DT will update the database with the new documents when the folder group is activated in DT.

That works great - thanks! :smiley: