import and OCR to devonthink by cron job?

Hi!

I’m trying to write a script, triggered by cron, to import and ocr files from a specific folder to a specific database/group. I am not used to applescript therefore I would appreciate your help:

I found the folder action script “Import, OCR and Delete” but don’t need any user interaction. How can I preset target database and group IN the script?

I tried:

set theDatabase to open database “/test/test.dtBase2”
set theLocation to create location “/new”
import “/myfilefolder/test.txt” to theLocation in theDatabase

  • don’t work-

I realized, if a group already exists, I can switch to this group by “create location” as well. But how can I switch to a specific DB?

Is it possible, to run such a script without opening a window of devonthink?
Maybe like a real cron job without any logged in user?

Thanks

This should work:


set theDatabase to open database "/test/test.dtBase2"
set theLocation to create location "/new" in theDatabase
import "/myfilefolder/test.txt" to theLocation

You could change Preferences > General > Startup to “Do nothing”.

That’s not possible.

Thank you, it’s working fine!