Previously working AppleScript failing in DT4 beta

As part of a previously working Keyboard Maestro macro, i use the following AppleScript (developed by someone else), which seems not to work in DT4 beta:

set masterList to {}
tell application id "DNtp"
	set allDatabases to every database
	repeat with thisDatabase in allDatabases
		set dbName to name of thisDatabase
		set allGroups to (every record of thisDatabase whose type is group)
		set groupList to {}
		repeat with thisGroup in allGroups
			set groupName to name of thisGroup
			set groupUuid to uuid of thisGroup as string
			if groupName is not in {"Trash", "Tags"} then
				set tempList to groupName & ":" & groupUuid
				if groupList = {} then
					set groupList to tempList
				else
					set groupList to groupList & "
" & tempList
				end if
			end if
		end repeat
		if groupList ≠ {} then
			if masterList = {} then
				set masterList to groupList
			else
				set masterList to masterList & "
" & groupList
			end if
		end if
	end repeat
	--set masterList to "[" & masterList & "]"
end tell
set saveTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"
"}
set masterList to masterList as string
set AppleScript's text item delimiters to saveTID
return masterList

ScriptEditor points to the parenthetical portion (every record…) in the sixth line as the culprit:

set allGroups to (every record of thisDatabase whose type is group)

I’ve checked the AppleScript dictionary for DT4, but can’t figure out what, if anything, might have changed in the syntax. The error message is:

error “DEVONthink got an error: Can’t get property list item.” number -1728 from

Thanks for any help.

Development would have to assess this as it works in DEVONthink 3.

The script suite was completely rewritten and although almost all scripts still work due to e.g. lots of synonyms, this is not always the case. Databases do not contain records anymore as this old one-to-many relationship was actually limited to the items of the root of the database, dating back to v1.x and not really useful.

In this case just use…

set allGroups to (parents of thisDatabase whose type is group)

…and this returns indeed all groups of the database. But if you prefer only the groups located in the root of the database, then use…

set allGroups to (children of root of thisDatabase whose type is group)
4 Likes

Excellent - thanks so much!