Hazel rule script for importing/indexing to a specific group

*SOLVED

Hi there,

not knowing anything concerning AppleScript, I try to use the above mentioned script to move pdf files (creditcard bills) with Hazel into a DEVONthink group. I copied the UUID and placed it into the script.

tell application "Finder"
	set _path to (the POSIX path of theFile as string)
	set {_name, _extension} to {name, name extension} of theFile
	
	-- optional: hide extension in Finder
	set extension hidden of theFile to true
	
	-- optional: remove extension for DEVONthink displays
	set _name to text 1 thru -((count _extension) + 2) of _name
	set _extension to "." & _extension
end tell

-- Launch DEVONthink if it isn't already open.
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

-- Import the file.

tell application id "com.devon-technologies.thinkpro2"
	set theGroup to get record with uuid "E2819D1A-8817-43AC-9514-56FFFA217857"
	
	-- choose one option, Index or Import, comment out the other
	set theImport to import _path name _name to theGroup
	-- set theIndex to indicate _path to theGroup
end tell

-- that here is important
return true

Unfortunately I do receive the following error


At least one of the actions has an empty field or an error. Please fill in the field, correct the error or remove the action

and in the Hazel preview this


Invalid AppleScript return value: <NSAppleEventDescriptor: 'obj '{ 'form':'ID  ', 'want':'DTcn', 'seld':65536, 'from':'obj '{ 'form':'ID  ', 'want':'DTkb', 'seld':2, 'from':[0x0,73073 "DEVONthink Pro 

I can see in Hazels script preview that it opens the correct folder and as well that it puts a file that i have to choose manually, into the right group (Kreditkartenabrechnung). But it still shows the error message and I can’t store the script in Hazel.

Thanks for your guidance,
Robert

macOS 10.14.3 (Mojave)
DEVONthink Pro Office 2.11.2

*SOLVED
I did the following to solve it:

  1. in Mojave give Hazel full disk access https://www.noodlesoft.com/kb/giving-hazel-full-disk-access-on-mojave/
  2. you need to add ```

return true