Tweaked BBEdit to DEVONthink link script

The old one bugged me, so here we go:


tell application "BBEdit"
	set d_url to the URL of text document 1
	set d_name to the name of text document 1
end tell

tell application "DEVONthink Pro"
	activate
	set theGroup to missing value
	set theGroup to (display group selector "Where?") 
	if theGroup is not missing value then
		set theArchive to create record with {name:d_name, type:rtf, URL:d_url, rich text:"Notes on " & d_name & ":
"} in theGroup
	else
		set theArchive to create record with {name:d_name, type:rtf, URL:d_url, rich text:"Notes on " & d_name & ":
"}
	end if
end tell

(Clearly based on Loren Ryter’s ‘Add web archive to DTP (Choose Group)’, and the existing ‘Save a Link to DEVONthink’ script)