Created
February 2, 2012 23:30
-
-
Save kch/1726439 to your computer and use it in GitHub Desktop.
Copy the URLs for the selected messages in Mail to the clipboard.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# encoding: UTF-8 | |
require 'appscript' | |
require 'cgi' | |
################################################################### | |
# Copy the URLs for the selected messages in Mail to the clipboard. | |
################################################################### | |
mail = Appscript::app("Mail") | |
urls = mail.selection.get.map { |msg| "message://" + CGI.escape("<#{msg.message_id.get}>") } | |
open('|pbcopy', 'w') { |io| io.write urls.join("\n") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment