Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brettkelly
Created November 8, 2011 21:43
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettkelly/1349348 to your computer and use it in GitHub Desktop.
Save brettkelly/1349348 to your computer and use it in GitHub Desktop.
Get the message:// URL of the selected message in Mail.app
tell application "Mail"
set selectedMsgs to selection
repeat with theMsg in selectedMsgs
set message_url to "message://%3c" & (the message id of theMsg) & "%3e"
tell application "Finder"
set the clipboard to message_url as text
end tell
exit repeat -- leave the repeat loop after one pass
end repeat
end tell
@brettkelly
Copy link
Author

This AppleScript will grab the URL for the selected message in Apple Mail. If more than one message is selected, it will grab the URL for the first selected message and ignore the rest. The resulting URL will be shoved onto the system clipboard for pasting elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment