How to window on smart group using AppleScript?

Earlier this year I posted about an approach to using KM macros to jump to specific groups in new windows. @cgrunenberg and the rest of the DEVONthink team made it easier as of version 3.6.2 with an addition to the AppleScript dictionary. Today I tried to use the same approach with a global Smart Group instead of an ordinary group in a database, and it’s failing, and I don’t know why. Maybe someone can help me figure it out?

The AppleScript is very simple:

try
	tell application id "DNtp"
		set newWindow to open window for record ¬
			(get record with uuid "73FA90B7-A7F0-4A1C-B3DB-D42FA2DA98BD") ¬
			with force
	end tell
end try

I obtained the UUID by control-clicking over the Smart Group and selecting Copy Item Link, then extracting the UUID part. Executing the script above does nothing – no error, no open window, nothing in the DEVONthink log. So, I have no idea why it’s failing, or how to fix it.

By comparison, the identical code with the UUID of a normal group works as expected.

(To be clear, this is not a question about the new force keyword; using my previous AppleScript code suffers from the same issue.)

Is this a global smart group? The items of the sidebar like global smart groups/rules are not records and not scriptable currently.

1 Like

Indeed, it is a global smart group. Ok, so that explains it. Thanks for the ultra-fast reply.

In this specific case in my usage, it doesn’t have to be global, so I’m going to move it into a database. However, there are some other global smart groups that would be nice to be able to jump to using this script approach, so if in a future release this limitation could be a addressed, it would be appreciated. I just remembered why I had made this a global smart group: it is because the only way to retain a specific column arrangement in the group is to use the trick discussed elsewhere: to use a global smart group. Otherwise, the smart group gets the column choices of the rest of the database.

1 Like