How do I copy a link to a Mail.app message without using drag-and-drop?
Based on splattne's response, and this macosxhints entry, I figured out how to do it. Now, it's just a matter of using something like Quicksilver of FastScripts to bind it to a keyboard shortcut.
tell application "Mail"
set selectedMessages to selection
set theMessage to item 1 of selectedMessages
set messageid to message id of theMessage
-- Make URL (must use URL-encoded values for "<" and ">")
set urlText to "message://" & "%3c" & messageid & "%3e"
set the clipboard to (urlText)
end tell
If I correctly interpret your question, you could use a variation of the AppleScript in these blog posts:
- Getting a Hyperlink of the Last Sent Message from Mail.app using Applescript
- Speedy creation of rich text links to Mail messages