The following proof of concept seems to do the trick for me:
Code:
tell application "Mail"
tell message viewer 1
tell message 1 of inbox
set theStr to "message://%3c" & message id & "%3e"
end tell
end tell
end tell
tell application "OmniFocus"
tell front document
make new inbox task with properties {name:"test", note:theStr}
end tell
end tell
It produces the same URL text that the OmniFocus Clip-o-Tron does. It won't work on an iOS device, but it should work for the Mail app on the Mac. If you're trying to do links to multiple messages, you need to extract the message id from each one in turn and generate a link.