Created
March 14, 2017 13:27
-
-
Save schrader/f1d2b64776b8e859d03b384eb41338e4 to your computer and use it in GitHub Desktop.
Mail.app Mac - Put Message Link on Clipboard -- AppleScript/Service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
SCRIPT NAME: Copy Email Link (Mail.app) | |
DATE: 2017-03-14 VER: 1.0.0 | |
PURPOSE: | |
• Get message link of selected Mail.app message | |
• Copy to Mac Clipboard | |
AUTHOR: Julian J. Schrader | |
Please email [email protected] with any bugs/issues/questions | |
INSTALLATION: | |
• Use Mac OS X's Automator to create a new SERVICE | |
• Set it to accept “no input” in “Mail.app” | |
• Add one “Run AppleScript” action | |
• Copy and paste this script into the action | |
• Save the new service | |
• Go to “System Preferences” > “Keyboard” > “Shortcuts” > “Services”, find your new service in the list and set a keyboard shortcut (e. g. ⇧⌃⌥⌘C) | |
REF: | |
• I adapted my Evernote link copying script: | |
https://gist.github.com/schrader/6e5155af45bc090278310999825df87c | |
====================================================================== | |
*) | |
tell application "Mail" | |
set theSelection to selection | |
set theMessage to first item of theSelection | |
set theUrl to "<" & message id of theMessage & ">" | |
set theUrl to do shell script "/usr/bin/python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of theUrl | |
set theUrl to "message://" & theUrl | |
set the clipboard to theUrl | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment