Crazy suggestion: accept links in search boxes

This script adds a record’s Reference URL to its aliases.

-- Add Reference URL to aliases	

tell application id "DNtp"
	try
		set theRecords to selected records
		if theRecords = {} then error "Please select some records."
		
		repeat with thisRecord in theRecords
			set thisRecord_ReferenceURL to reference URL of thisRecord
			set thisRecord_Aliases to aliases of thisRecord
			
			if thisRecord_Aliases does not contain thisRecord_ReferenceURL then
				set thisRecord_Aliases_list to my tid(thisRecord_Aliases, {", ", "; ", ",", ";"})
				set end of thisRecord_Aliases_list to thisRecord_ReferenceURL
				set thisRecord_Aliases_string to my tid(thisRecord_Aliases_list, ", ")
				set aliases of thisRecord to thisRecord_Aliases_string
			end if
			
		end repeat
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell

on tid(theInput, theDelimiter)
	set d to AppleScript's text item delimiters
	set AppleScript's text item delimiters to theDelimiter
	if class of theInput = text then
		set theOutput to text items of theInput
	else if class of theInput = list then
		set theOutput to theInput as text
	end if
	set AppleScript's text item delimiters to d
	return theOutput
end tid