This is an update to this hint, Automatically add links from Emails, Twitter or Google Reader to Reading List . I found the solution posted there to be insufficient. The script only allows URLs to be on their own full line, whereas my solution scans the entire message for links everywhere. As long as they are separated by a space the script should find them. WebKit users can even set their own browser.
I hope this helps replace some "read later services" by Reading List.
Save the script below to ~/Library/Application Scripts/com.apple.mail/ and assign it to a new Mail rule.
An easier way to send yourself links is by adding +reading to your mail address. If your normal address is myaddress@gmail.com, it would become: myaddress+reading@gmail.com.
The beauty of this is that you can add this address to your Contacts and give it a nice name like “Add to Reading List”. The previous hint required editing e-mail subject lines in a predefined way. Apps like Reeder are able to send to a default mail address. With this, set the +reading address to be your default address, share via e-mail, tap Send, and it's done.
Set up a new rule with the following options:
Here’s the script (you can also get it on GitHub):
(*
Add to Reading List
Script for Apple Mail to find http and https links in emails and add them to Safari's Reading List automatically.
Best practice: setup with "any recipient contains '+reading'".
Actions "mark as read", "execute AppleScript", "delete message", "stop evaluating rules"
Created by Andreas Zeitler on 2012-10-07
*)
using terms from application "Mail"
set theURLs to {}
on perform mail action with messages theMessages
try
set theMessageCount to count of theMessages
repeat with theMessageIndex from 1 to theMessageCount
set theMessageContent to content of (item theMessageIndex of theMessages)
-- find URLs in messages
set cmd to "echo \"" & theMessageContent & "\" | egrep -o -e 'http[s]?://\\S+' | sed 's/[<>]//'"
set theURLs to do shell script cmd
-- make URLs a list
set theURLs to paragraphs of theURLs
-- add URLs to reading list
my addToReadingList(theURLs)
end repeat
end try
end perform mail action with messages
end using terms from
on addToReadingList(theURLs)
-- set your preferred browser. Use "Safari" or "WebKit"
set myBrowser to “Safari”
using terms from application "Safari"
tell application myBrowser
repeat with theUrl in theURLs
add reading list item theUrl as string
end repeat
end tell
end using terms from
end addToReadingList
Comments (0)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20121007141125201