Displaying the last view file changed in DT3?

I may be mistaken but I’m missing the ability to return to the last viewed file that existed in DT2. I had a good. solution based on this thread here: Moving from inbox to the group selected by classify but doesn’t seem to work in DT3.

The usage case is the same - I examine a file and decide to move it to a group via a Move of Classify operation. Then I would like to move to that file now located inside the group. As an illustration: I move “Document 1” to the group “Folder”. The I would like to go to the “Document 1” inside group “Folder” to continue working with all the context of the files related to Document 1.

In DT I could use the “Go Back” command to do this - if I’ve understood the help documentation of DT3 “Go Back” is now dedicated to wiki links but not to files, to whit

Moves backwards and forwards through all documents/web pages you have visited by following cross-links or Wiki-style links.

I miss the DT2 functionality so hope that move backwards and forwards through the documents visited using DT3 interface and not the links can be implemented.

I use the following script, which I have added to the toolbar folder (/Users/yourusername/Library/Application Scripts/com.devon-technologies.think3/Toolbar).

tell application id "DNtp"
		set currDate to current date
		set theComparisonDate to currDate - 86400
		set theDatabases to databases
		repeat with thisDatabase in theDatabases
			set thisDatabasesResults to search "additionDate >" & theComparisonDate in (root of thisDatabase)
			if thisDatabasesResults ≠ {} then
				repeat with i from (count thisDatabasesResults) to 1 by -1
					set theRecord to item i in thisDatabasesResults
					if type of theRecord is not in {group, smart group} and type of parent 1 of theRecord is not feed then
						set thisDatabasesLastAdded to theRecord
						exit repeat
					end if
				end repeat
					if (addition date of thisDatabasesLastAdded) ≥ theComparisonDate then
						set theComparisonDate to (addition date of thisDatabasesLastAdded)
						set globalLastAdded to thisDatabasesLastAdded
					end if
				end try
			end if
		end repeat
		if viewer window 1 exists then
			set theBounds to bounds of viewer window 1
			set newWindow to open window for record parent 1 of globalLastAdded
			set bounds of newWindow to {(item 1 of theBounds) + 22, (item 2 of theBounds) + 22, ((item 3 of theBounds)), (item 4 of theBounds)}
			set newWindow to open window for record parent 1 of globalLastAdded
		end if
		set selection of newWindow to {globalLastAdded}
	on error error_message number error_number
		if the error_number is not -128 and error_number is not -2753 then
			display alert "DEVONthink 3" & space & error_number message error_message as warning
		end if
	end try
end tell

That will open a window with the last document added to any database selected. This is not quite what you are asking after, because the date added will not change if you move an item within a database; it will change if you move the item from the global inbox to a database, though. However, depending on your precise use case, you may be able to use the script as is, or with some modifications.

As far as I can remember, it was @pete31 who very kindly provided the script to me.

1 Like

There is no missing functionality in regards to navigating to previous and subsequent documents.
The arrows in the Navigation Bar over the view/edit pane do exactly that.

From the Help > Documentation > Documents > General > Navigation Bar

(Though I could suggest I can add an or in the statement. However, the behavior is easily testable.)

Thanks @BLUEFROG. My question could have been clearer and has several components. What I’m trying to find out is

  1. Whether the behaviour of “Go Back” changed from DT2 to DT3. As far as I can tell from our exchange in 2019 mentioned in my post “Go Back” in DT2 meant Navigate back to the last visited document whereas it now means Navigate to the last visited document after following a link. If so there is a difference which impacts my workflow even if the new behaviour is clear and well described in the DT help docs.
  2. If so the solution kindly offered by @Blanc comes closer to my workflow needs as it will select and open the group (in a new window) the last document added to any database. I find myself often sorting through documents in the InBox, moving a given document with the help of Classify and then checking the document in it’s new Group with the help of support files found in that group (hence the need to move inside the Group holding the most recently selected file).

The back arrow in the document Navigation bar will navigate to previously viewed documents, or in the case of web browsing, the previously visited page.
This was the same behavior as DEVONthink 2.x.