Use (almost) DEVONthink 2 style inboxes in DEVONthink 3

Hi there, triggered by this thread and especially this post I’ve found the following setup, thanks @ngan!

If you want to use a DEVONthink 3 database’s inbox inside the database part of the sidebar then that’s possible with a triggered script and/or a smart rule.

Don’t be scared off by “script”, it’s easy to set up and there’s also a helper script that creates the necessary “fake” incoming group and attaches the trigger script.

You don’t need to use the helper script it’s just for convenience, but then you have to create the “fake” incoming group manually and attach the trigger script to it. Also you don’t really need both together, a trigger script and a Smart Rule, but while trying and testing I created both and as I couldn’t get the Smart Rule alone to trigger in every case I ended up using both together.

Important: try this setup with a test database first!

To use an inbox (almost) as it was in DEVONthink Pro

  1. save the trigger script somewhere (you can use Script Editor.app)
  2. copy the path of the script (right click and hold the option key, this will change the context menu to “Copy path”
Trigger script
-- Move all records of incoming group to the fake incoming group you (or the second script..) attached this script to  

on triggered(theRecord)  
	tell application id "DNtp"  
		try  
			set theRecords to every child of (incoming group of current database)  
			
			repeat with thisRecord in theRecords  
				move record thisRecord to theRecord  
			end repeat  
			
		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  
end triggered  

  1. paste the path into the helper script
  2. change the name of the “fake” incoming group to the desired one (you have to use the same name later in the Smart Rule)
  3. save the script somewhere, e.g. in DEVONthink’s script menu. (If you don’t want to add more databases or just want to test this setup then you don’t have to save it, it’s just for convenience)
Helper script
-- Create fake incoming group and attach trigger script that moves all records from the incoming group to this group  

property triggerScriptPath : ""  

tell application id "DNtp"  
	try  
		set theDatabase to current database  
		set theDatabasename to name of theDatabase  
		
		set theName to ".Eingang [" & theDatabasename & "]" -- change to desired name  
		
		set theGroup to create location "/" & theName & "/" in theDatabase  
		set attached script of theGroup to triggerScriptPath  
		
	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  

  1. create a Smart Rule with scope set to the database’s incoming group, kind:any or kind:group and paste the Smart Rule script as embedded script. I use “after import” as action.
  2. set the name of the database in the Smart Rule script (Important: Be careful when copying this Smart Rule, it’s easy to forget to change the database name…)
  3. set the group name (you’ve chosen in step 4) in the Smart Rule script
Smart Rule script
-- Move records from incoming group to fake incoming group  

property theDatabaseName : "" -- BE CAREFUL WHEN COPYING A SMART RULE THAT USES THIS SCRIPT  

on performSmartRule(theRecords)  
	tell application id "DNtp"  
		try  
			set theDatabase to database named theDatabaseName  
			set theChildren to (every child of (incoming group of theDatabase))  
			
			set theGroup to create location "/.Eingang [" & theDatabaseName & "]/" in theDatabase -- change to desired name  
			
			repeat with thisChild in theChildren  
				move record thisChild to theGroup  
			end repeat  
			
		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  
end performSmartRule  

The Smart Rule should look something like this

Screenshot%20Smart%20Rule

Didn’t test much, but it works and I think I’ll use this as long as it’s not possible to change the name of an DEVONthink 3 incoming group (quite confusing sometimes…)

Mine is just cheap talk haha. You make it happened.

Why are you creating a triggered script for this?

Because I couldn’t get the Smart Rule to do it alone. It didn’t trigger in some test cases. Maybe I should have created several Smart Rules to use different actions?

The purpose of smart rules and triggered scripts is to provide repeated actions. Your scenario is a one-off situation. You wouldn’t be making multiple instances of a database’s Inbox into a smart group. You’d do it on a per-database basis, then be done with it. This is the territory of an internal script.

no my scenario is not a one-off situation. I still use the inboxes in the Sorter and in DTTG

I still use the inboxes in the Sorter and in DTTG

I’m not sure what this has to do with the situation you were referring to.

And I don’t know which situation you think I have referred to? I just read the thread I linked in the first post, tried ngans suggestion and then tried my own. This is by the way why I used a triggered script, because ngan mentioned it.

I don’t use the inboxes tree anymore, but I use the built-in inboxes in Sorter sometimes and on iPhone so there are new records coming in. It’s not just moving the built-in inboxes content to another group once. I don’t see how an internal script could do this.