Go to last moved document


Is there a method to go to the document you moved last? I can’t find one, but I may have missed it.

Use case: you refile a document to another group (I usually use Cmd-Ctl-M (Move to...), but it would apply whenever a document is moved to a new group) and you want to follow it to its new home to see it’s settling in nicely.

At the moment, AFAIK, you can

  • try to use Cmd-[ (Go > Back) and hope that it works. IME it usually doesn’t and you get the document before the one you’re after; or

  • use Go > To Document (or Group) and type in the document / group name, which works but is fiddly for something which can be done several times a day.

Org-mode in Emacs has commands (org-capture-last-stored and org-refile-last-stored) which take you the document you last moved for precisely this scenario, and they are very useful.

Does DT3 have an equivalent?

If not, please could it be a feature request to add the equivalent command to the Go menu?

Many thanks.

You might want to check this thread, in which @pete31 so kindly provided me with a solution for exactly that problem.

I think I ended up adapting the script a little bit; anyway, this is what I have used for ages (it opens a new window, partially overlaying the original one, at the location of the last moved document, with that document marked):

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

Hah, thank you!

I searched on ‘Move…’, not ‘Jump…’ so didn’t find that… @pete31 really is a mine of useful scripts :grinning:. And thank you for your amendment, too. I shall check it out.

Many thanks!

For DT3 support: it would nice if this could be implemented in a future release, though I realise that there’s a long list…



Thing is, it is really simple just to implement it yourself :slight_smile: I’ve even designed a little icon for the script, so it sits (together with a number of others) in my toolbar and is used daily :slight_smile:

True, but then you have to search for how to do it and implement it.

We already have ‘Move to [same group as last move]…’, which is the same principle. ‘Go to [same group as last move]…’ is another convenience along the same lines.

Anyway, thanks for your pointer. It’s really helpful!

That is part of the fun - and it makes it fully customisable :slight_smile: It’s ok, I get your feedback - I’m just more for DT adding things I can’t add myself than spending their limited resources on stuff the user can do. Well, with @pete31’s aid, anyway :smiley:


The next release will add this command (as it sounds indeed useful).


Thanks very much, Christian!