This is a rough-and-ready version:
tell application "DEVONthink Pro"
activate
try
set this_selection to the selection
if this_selection is {} then error "Please select some contents."
repeat
display dialog "Enter tags to add:" default answer "" buttons {"Cancel", "OK"} default button 2
set newTag to the text returned of the result
if newTag is not "" then exit repeat
end repeat
repeat with this_item in this_selection
set current_tags to the tags of this_item
if current_tags is not "" then
set new_tags to current_tags & " " & newTag
else
set new_tags to newTag
end if
set the tags of this_item to new_tags
end repeat
on error error_message number error_number
if the error_number is not -128 then
try
display alert "DEVONthink Pro" message error_message as warning
on error number error_number
if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
end try
end if
end try
end tell
Now: how would I need to change this so I can add more than one tag at a time?