Hazel and DevonThink - Sending/import PDF-files to DT

Hi,

I’ve been trying to find a script that I can use in my workflow (and do so with zero skills in Applescript). I want to use Hazel to move files (.eml) from a folder located in “My Documents” to a specific folder in my DTPO database.

I found this script from Korn (Hazel rule script for importing/indexing to a specific group) but haven’t been able to get it to work. I keep getting a script error. Does it need updating or am I doing something wrong?

tell application "Finder"
	set _path to (the POSIX path of theFile as string)
	set {_name, _extension} to {name, name extension} of theFile
end tell

tell application "System Events"
	if not (exists process "DEVONthink Pro Office") then
		tell application id "com.devon-technologies.thinkpro2" to activate
	end if
end tell

tell application id "com.devon-technologies.thinkpro2"
	set theGroup to get record with uuid "D26E06DA-ADB8-4AEE-AB53-AA7B95359AF0"
	set theImport to import _path name _name to theGroup
end tell