Updated move file script for DT3.5

The move with hotkey now works again in DT3.5 and bound to Command-Alt-Shift-M.
By placing the script with this file name, it binds automatically to the hotkey within DT3.5.
Then it pops up a selection much nice than the ‘right click move to’ which is keyboard driven and lets you pick the destination directory for the move

The script file was name:

MoveItems___Cmd-Alt-Shift-M.scpt

And the content is:

use AppleScript version “2.4” – Yosemite (10.10) or later

use scripting additions

property NoTop : false – set to true (no quotes) to guard against moving to root

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”

if the location of theDestination is “/” then – new conditional added in 20170207.3

if NoTop then error “Cannot move to the database root”

end if

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

It appears you’ve not read the documentation or explored very far. :wink:
Data > Move To or Control-Option-M

Very good - the UI for this works with the keyboard and is pretty much the script above. It is now integrated! Super!

It’s just my understanding and I could be wrong: using the script won’t work for items with replicants, but the DT’s standard function will work. For moving items - when there are replicants - one should use DT’s function.

If you have an item with replicants, the the location of item 1 of theSelection will always return the location of its first parent. That means if the group in which the item you want to move is not the first parent (where the item is created/imported/indexed into DT initially), the script will move the item from the wrong group into the destination group. It took me a long time to figure this out. But the DT’s Data > Move To doesn’t have this problem.

Just my 5 cents.