Aliase from selection

Would be helpful to be able to select some (comma separated) text in a note to add as Aliases. I often work with multiple languages/translations and would like to wiki-link from expressions in either languages.


You could save this script in ~/Library/Application Support/DEVONthink Pro 2/Scripts and access it via DEVONthink’s scripts menu:

tell application id "DNtp"
		set theWindow to think window 1
		set theSelection to selected text of theWindow
		if theSelection is not missing value and theSelection is not "" then
			set theRecord to content record of theWindow
			set theAliases to aliases of theRecord
			if theAliases is not "" then
				set aliases of theRecord to theAliases & "," & theSelection
				set aliases of theRecord to theSelection
			end if
		end if
	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
end tell