DT and Hazel


I’m trying to set up a system to have Hazel automatically move a file into a specific DT folder. I know little/nothing about scripting, but using this info (noodlesoft.com/forums/viewto … f=3&t=4694) I thought the short shell script below would work to move test.pdf into the folder Test in my DT database. It does not. I would appreciate any suggestions. Thanks!



tell application id “com.devon-technologies.thinkpro2”\n
set theDatabase to open database “/Users/Aaron/Documents/DevonTHINK/Personal.dtBase2”\n
import “/Users/Aaron/Desktop/DTtest/test.pdf” to Test\n
end tell\n

“Import” requires a location, and so the syntax for “import” is

set theGroup to create location "/Test" in theDatabase
set theResult to import "/Users/Aaron/Desktop/DTtest/test.pdf" to theGroup

If the location (/Test) already exists, the first statement will not create it, but will only assign the address to theGroup. theResult is required by the syntax, and is a record variable, so you could address theResult to set tags or other properties of that record.

I’m curious as to why you’re writing Applescript code with a shebang. This would require osascript, but why not just go for a pure Applescript option?

Wow, thanks so much. Works great!

That would be because I don’t know any better. I was just trying to follow the linked example.