I modify the excellent script from Korm at Move items with the keyboard between databases (re-imagined) with three added features to tailor for my usage. This might come handy to some other users.
(1) Open a new main window for the destination group. Rather than just moving the items to a destination group, the destination group is opened as a separate main window. This comes handy for me coz I just need to drag and drop other items or items in different groups to the new window afterwards, or I can check whether the items have been moved to the correct group immediately after the move.
(2) Choose where to place the destination window on the screen. I specify the size of the new group window to a quarter of the screen, and the window can be placed at either the lower, mid, or upper portion at the left edge of the screen. (I need hard-coding the resolution coz I am using multiple screens).
(3) Choose one of the two types of item move. This option should be chosen/decided carefully. “Move all instances of items” consolidates all replicants of each item, and only one unique instance of items will be retained and moved (suitable for house cleaning). “Move items in this group only” only move the specific instance of selected items and all other instances will remain intact.
Disclaimer: The original script supports the cross-database move, I haven’t tested the script for this purpose and do not plan to test for it (I don’t have the need). If you use and test the script for cross-database movement, let me know wether it works. I.e. Use it at your own risk for cross-database move!
(*
Original script by Korm https://discourse.devontechnologies.com/t/move-items-with-the-keyboard-between-databases-re-imagined/16860
Move the selected record(s) to a destination
that was selectected from the Group Selector panel
20140112.1
20170207.3 added optional guard against moving to a database's root
Modified by Ngan
20190626.1
*)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- Specify the full screen resolution of the active monitor
-- set {screenWidth, screenHeight} to {4608, 1944}
-- set {screenWidth, screenHeight} to {3360, 1890}
set {screenWidth, screenHeight} to {3840, 2160}
set {WinWidth, WinHeight} to {screenWidth / 2, screenHeight * 0.5} -- newly opened main window sized as a quarter of the screen
set yAxis to 0
set xAxis to 0
-- Option Settings 1
set MovAllInstances to false -- Set to true if wanting to consolidating all replicants into one
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 theFrom to the current group
set fromPath to (the location of item 1 of theSelection) & (the name of item 1 of theSelection)
set fromDatabase to the name of theDatabase
if MovAllInstances is true then
set theDestination to (display group selector "MOVE ALL INSTANCES OF ITEMS: Select a Destination")
else
set theDestination to (display group selector "MOVE ITEMS IN THIS GROUP ONLY: Select a Destination")
end if
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
if MovAllInstances is true then
repeat with thisItem in theSelection
move record thisItem to theDestination
end repeat
else
repeat with thisItem in theSelection
set thisItem to move record thisItem from theFrom to theDestination
end repeat
end if
-- 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"
open window for record (item 1 of theDestination)
-- Option settings 2: location of the newly opened destination window
set bounds of window 1 to {xAxis, yAxis, xAxis + WinWidth, yAxis + WinHeight} -- upper left corner
-- set bounds of window 1 to {xAxis, yAxis + WinHeight / 2, xAxis + WinWidth, yAxis + WinHeight / 2 + WinHeight} -- mid of left edge of the screen
-- set bounds of window 1 to {xAxis, yAxis + WinHeight, xAxis + WinWidth, yAxis + 2 * WinHeight} - lower left corner
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