That’s a simple thing to do in AppleScript. But why not use the Move To popover? If you hold ⌥ you duplicate files instead of moving them, and with ⌘⌥ you replicate.
I never used Keyboard Maestro, so I don’t think I can help with that part.
From what I understand you want to replicate, but choose the destination from a small list of groups?
If there is a consistent pattern, it might be possible to completely automate this using a smart rule and avoid issuing any commands at all.
But here is an example AppleScript that replicates all selected records to a (single) predefined destination:
tell application id "DNtp"
set theDestination to get record with uuid "x-devonthink-item://..." -- item link of destination group
repeat with theRecord in (selected records)
if (database of theRecord) = (database of theDestination) then
replicate record theRecord to theDestination
else
display alert "Error" message "Item and destination are in different databases."
log message "Can't replicate to database \"" & name of (database of theDestination) & "\"" record theRecord
end if
end repeat
end tell
Re: Your question to @DTLow – You can try searching the forum’s automation category to see if someone has created a script that deals with a situation similar to yours. I’m not aware of any right now.
Though you generally don’t “find” scripts, you write them
If you don’t know any AppleScript, you can start learning. Or you can try asking for help!
I do think it shows good manners to search the forum and see if someone has already solved your problem first.
It’s not very elegant, but you can use KM to utilize the context menu. You’d also have to update it depending on if the context menu changes. This invokes the context menu, searches for the first 3 letters “rep” in replicate, return to go to the submenu, delete to jump to the search field, enters the group name you want, and assumes it’s the first in the search list and selects that as the group target.