This is likely not something that would be routinely done, so scripting it would offer little to no future fruit.
You’d still have to build a list of Tags and choose from a list of them, so you’re essentially in the same boat to some degree.
I think you’re imagining some prescience in AppleScript that isn’t there (like it knowing “Peter” is your “friend”).
If the hierachy was more than one level deep, you’d have an even more complex report and display task to deal with.
I suggest this is best done manually on an as-need basis.
And if you mistyped or forgot the tag you entered?
Also, you’re trading mouse movement and menus for typing (which is very prone to error), so is the trade-off really a good one?
PS: There’s no specific “command for moving a Tag”.
Here is a proof of concept approach, commented for teaching. Again, I’m not advocating this process, but showing it is possible and also may be adapted for other uses.
-- DT Nest Tags_teaching
-- Created by Jim Neumann / BLUEFROG on Tue Jan 08 2019.
-- Copyright (c) 2018 BLUEFROG / DEVONtechnologies, LLC. All rights reserved.
--- Note this is NOT checking for already nested Tags. This is moving a root level Tag into another root level Tag.
tell application id "DNtp"
--- Specify the Tag to move and check for its existence. ---------------------------
set tagToMove to text returned of (display dialog "What Tag do you want to move?" default answer "")
-- Ask for the name of the Tag to move.
if tagToMove is not "" then
--- If the User didn't enter an empty Tag…
set recordToMove to get record at ("/Tags/" & tagToMove)
-- Check for the existence of the Tag.
else --- Otherwise, Issue a warning.
display alert "You entered a blank Tag." as critical
return -- A return stops the script as there's no point in continuing.
end if
if recordToMove = missing value then -- If no Tag was found…
display alert "The Tag, " & tagToMove & ", could not be found. It doesn't exist or you mistyped it." & return & "Remember: Tags are case-senstive." as critical
return
end if
--- Specify what Tag to move the Tag into and check for its existence. ---------------------------
set tagToReceive to text returned of (display dialog "Where do you want to move the Tag?" default answer "")
if tagToReceive is not "" then
set recordToReceive to get record at ("/Tags/" & tagToReceive)
else
display alert "You entered a blank Tag." as critical
return
end if
if recordToReceive = missing value then
display alert "The Tag, " & tagToReceive & ", could not be found. It doesn't exist or you mistyped it." & return & "Remember: Tags are case-senstive." as critical
return
end if
---If neither conditional above errors, the Tags should be found, so go ahead and move the Tag into the other.
move record recordToMove to recordToReceive
end tell
One question though: How does the script know which database the entered tags should belong to? Does it just use the database selected in the front window?