Continuous (re)classification

Hi there,

I wonder if there is a way to identify all documents that are classified different than the ai would do ?
I want to use the classification functionality in my process of reorganisation or reviewing my structure.
Did I miss something ?

regards
Andreas

Not that I am aware of; you can determine both the location of an item and its suggested classification using AppleScript though, so it should be possible to automatically compare the results of both and tag files which are not in the first (or a list of several) suggestion(s). You could then use a smart group to show up those files.

As a thought experiment:

tell application id "DNtp"
	set theSelection to the selection
	set theRecord to first item of theSelection
	set theClass to classify record theRecord
	set topClass to first item of theClass
	set theParent to get id of parent of theRecord
	set theBase to get id of database of theRecord
	display dialog "Current Parent ID: " & theParent & "
Curent Database ID: " & theBase & "
Suggested Class: " & topClass
end tell

Can somebody please tell me how to extract <<class DTpr>> and <<class DTkb>> from my variable topClass (which contains the line parent id 93081 of database id 5 of application "DEVONthink 3"); i.e. how do I pick “93081” and “5” from that variable to be able to use it to compare to the other variables? (@pete31?)

1 Like

The same way you did it with theRecord (but not sure I understood what you want to do)

tell application id "DNtp"
	try
		set theRecords to selected records
		if theRecords = {} then error "Please select a record"
		set theRecord to item 1 of theRecords
		set theClassification to classify record theRecord
		
		if theClassification ≠ {} then
			set theRecord_ParentID to id of parent 1 of theRecord
			set theRecord_DatabaseID to id of database of theRecord
			
			set theTopClassification to item 1 of theClassification
			set theTopClassification_ID to id of theTopClassification
			set theTopClassification_DatabaseID to id of database of theTopClassification
		else
			display notification "No classification"
		end if
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell
2 Likes

Cheers :slight_smile:

I just wanted to show an example of a script which determines where an item currently is and where it would be put if the AI classified it. If, in your example, the OP compared theRecord_ParentID to theTopClassification_ID (and the same for the DatabaseID) then they could tag any files where the two were not identical, thus finding files which are not currently classified as the AI would. This could obviously be extended, e.g. to tag only those files which are not in the first 3 suggestions made by the AI, or whatever.

As I suggested, its only a thought experiment, so it wasn’t my intention to provide a complete script (at least not until the OP says something like “oh, what a brilliant idea”).

3 Likes

Hi Blanc, Hi Pete,

sorry I wasn’t able to come back to this earlier.
You are very quick and I am happy that there seem to be a way to solve this. Thanks for your efforts !

Actually I have no experience with DT and apple script but if this is the way I can get it work, I need to dive into it.
BTW: Isn´t this a predestined case for what DT should provide as a native smart rule ? I always hear that DT is flexible in terms of organization and has a powerful ai, but sometimes its not easy to take quick advantage of this not being a kind of power user.

regards
Andreas

Your initial inquiry is unusual and specific to you so that wouldn’t be something we’d have provided a prebuilt solution for.

However, as shown by your fellow posters in this thread, DEVONthink provides tools to fulfill many types of these individual requests.

If you need help, give us a shout. Setting pete31’s script to compare and tag would be very simple to do. If you want to extend it to compare more than just the first AI suggestion it becomes more complex but remains relatively straightforward :slight_smile: