Move document into other DB with Keyboard Shortcut

Hi there,

having to put quite a lot of docs from one DB to another I wonder if this could be done using a keyboard shortcut.

Problem (for me) is, that it seems not to be a menu command, but under the “Actions” icon.

Any suggestions? I hate having to use my mouse for this kind of tedious redundant tasks …

  • Franz-Josef

You’re still going to have to use your mouse for many selections, aren’t you?
(Using a Keyboard to process a list of files feels even more inefficient to me, personally.)

I have this script which can be used for this purpose. I compiled and saved the script as “Move___Cmd-Ctrl-M” to DEVONthink’s internal script library. Note that after “Move” in the name there are three underscores – if you use a convention like this then the item will have that shortcut — ^⌘M.

What this does is, you select some files, press the shortcut, the script opens the Group Selector (which is like the Groups & Tags tool) and you select a destination with up / down arrows and press Enter to commit the move. Every time you run the script the last database / group selected is retained.

try
	tell application id "DNtp"
		
		set theDatabase to current database
		set theSelection to selection
		if theSelection is {} then error "Please select something"
		
		set fromPath to (the location of item 1 of theSelection) & (the name of item 1 of theSelection)
		set fromDatabase to the name of theDatabase
		
		set theDestination to (display group selector "Select a Destination")
		if theDestination is {} then error "We had a problem choosing the destination"
		
		set toPath to the location of theDestination
		set toDatabase to the name of the database of theDestination
		
		repeat with thisItem in theSelection
			move record thisItem to theDestination
		end repeat
		
		-- Post the result to the Log
		set movedFrom to "Moved from: " & fromPath & " in " & fromDatabase
		set movedTo to " -- Moved to: " & toPath & " in " & toDatabase
		set theLogEvent to log message (movedFrom & movedTo) info "Mover Script"
		
	end tell
	
on error error_message number error_number
	if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	
end try

FWIW, found korm’s script some time back, and it (as per usual) works a charm.

I set mine up to be triggered by BTT as well, so a 4 finger double tap on the trackpad when in DTPO invokes, and then my other hand on the keyboard simply uses the up/down to select a group, if its different to the previous one.

This way I can access it regardless of where my left hand is. Saves nanoseconds, but it’s always the little things! 8)

Thanks, korm and Cassady. As I tried to install the script I found that it is already part of the DT installation, so nothing to install, just to press Crtl+Cmd+M.

@korm: After executing the script, the focus is nowhere I see, so I have to click in the list view to move the next files. Is there a way to make the focus go back to the list?

I forgot that Eric added this to the distribution.

The script moved the thing(s) that had the focus to your destination group. So (a) there is no longer anything to focus on, and (b) how would the automation know what you meant to focus on next?

Correct, and the focus is on the group, out of which I moved the document, so 1 ArrowRight brings me back to the list.

Your script is really elegant allowing to create groups while moving - learned it and learned to appreciate it while working the last hours. So: Thx again!

Why don’t you use Keyboard Maestro.

You can configure a whole lot of shortcuts then. You can even configure a ‘palette of shortcuts’ (see screenshot)

Because

  • KM cannot activate menu items in contextual menus (“Move” is in a contextual menu) – this is the same limitation that the OP was up against with assigning a keyboard shortcut to move

  • The script gives access to the Group Selector from which any group in any database can be selected – plus adding new destinations if desired – a KM macro’s menu would have to be very long and difficult to navigate if one wanted to use such a thing for this purpose.

  • You could add scripts to KM to do the same thing as the suggested script, above, but you would end up at the same result after more work and more keystrokes

KM is great – it’s not the solution to everything, IMO If someway was always going to move documents to the same handful of destinations, then I’d say KM is good (but limited) choice. So are Favorites, for that matter.