Script:MailToThings MultiSelection.scpt

on run {input, parameters}
	
tell application "Mail"
set selectedMessages to selection
	
if (count of selectedMessages) is equal to 0 then
else
	repeat with theMessage in selectedMessages
		set the selected_message to item 1 of theMessage
		
		set theSubject to subject of theMessage
		set theSender to sender of theMessage
		set theMessageId to message id of theMessage
			
		if theMessageId is "" then
			display dialog "Can't link this message to Things!"
			return
		end if
			
		set message_url to "[url=message:%3C" & ¬
			theMessageId & ¬
			"%3E]" & ¬
			theSubject & ¬
			"[/url]"
			
		tell application "Things"
				
			set newToDo to make new to do ¬
				with properties {name:theSubject} ¬
				at beginning of list "Inbox"
				
			set newToDo's due date to current date
			set newToDo's notes to message_url
				
		end tell
	end repeat
end if
end tell
	
	return input
end run