Smart Group via AppleScript - is "item:!tagged" broken?

Creating a smart group for “item is not tagged” manually works, but it doesn’t via AppleScript.

theQuery is what I type into my script’s dialog, see the search predicates of the resulting smart groups below. It does work for indexed and fails for tagged… am I missing something?

	set theQuery to "item:!tagged"
	--> ""
	set theQuery to "item:tagged"
	--> ""

	set theQuery to "item:!indexed"
	--> item:!indexed
	set theQuery to "item:indexed"
	--> item:indexed

Here’s a script for testing

tell application id "DNtp"
	try
		set theQuery to "item:!tagged"
		
		set theSmartGroup to create record with {type:smart group, search predicates:theQuery, search group:incoming group, name:theQuery} in incoming group

		set theSearchPredicates to search predicates of theSmartGroup
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
	end try
end tell

This will be addressed in the next maintenance release.

1 Like